Linux 설치 Es 클러스터

10096 단어 ES
준비 자료:
1、elasticsearch-5.6.8.tar.gz
2、elasticsearch-head-master.zip
3、node-v8.1.4-linux-x64.tar.gz
서버가 3개인 경우:
xxx.xxx.2.172、xxx.xxx.2.173、xxx.xxx.2.175
각 서버는 다음과 같이 구성됩니다.
[wwwroot@zx20G ~]$ egrep -v "^#|^$" /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 zx20G 
xxx.xxx.2.172 es1                                                                                                                            
xxx.xxx.2.173 es2                                                                                                                            
xxx.xxx.2.175 es3

xxx.xxx.2.172

[wwwroot@zx20G ~]$ egrep -v "^#|^$" /etc/security/limits.conf 
elsearch         soft    nproc           65536
elsearch         hard    nofile        65536 
[wwwroot@zx20G ~]$ egrep -v "^#|^$" /etc/sysctl.conf 
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.max_map_count = 262144 -- 
[wwwroot@zx20G ~]$ sysctl -p  -- 
[wwwroot@zx20G ~]$ mkdir /app/appinfo/elsearch/
[wwwroot@zx20G ~]$ groupadd elsearch;
[wwwroot@zx20G ~]$ useradd elsearch -g elsearch -p elsearch;
[wwwroot@zx20G ~]$ chown -R elsearch:elsearch /app/appinfo/elsearch;
[wwwroot@zx20G ~]$ su elsearch;
[wwwroot@zx20G ~]$ cd /app/appinfo/elsearch;
[elsearch@zx20G elsearch]$ tar zxvf elasticsearch-5.6.8.tar.gz
[elsearch@zx20G elsearch]$ cd elasticsearch-5.6.8/config
[elsearch@zx20G config]$ vim elasticsearch.yml
---------------------------- -------------------------------
cluster.name: elk_test.cluster
node.name: esNode1
node.master: true
node.data: false
path.data: /app/appinfo/elsearch/data/elasticsearch
path.logs: /app/appinfo/elsearch/logs/elasticsearch
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["es1","es2","es3"]
discovery.zen.minimum_master_nodes: 3
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
---------------------------- -end------------------------------
[elsearch@zx20G elasticsearch-5.6.8]$ ./bin/elasticsearch -d   -- 
[elsearch@zx20G elasticsearch-5.6.8]$ ss -lntp|grep java
LISTEN     0      128                      :::9300                    :::*      users:(("java",23277,141))
LISTEN     0      128                      :::9200                    :::*      users:(("java",23277,167))


xxx.xxx.2.173

[wwwroot@zx20G ~]$ egrep -v "^#|^$" /etc/security/limits.conf 
elsearch         soft    nproc           65536
elsearch         hard    nofile        65536 
[wwwroot@zx20G ~]$ egrep -v "^#|^$" /etc/sysctl.conf 
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.max_map_count = 262144 -- 
[wwwroot@zx20G ~]$ sysctl -p  -- 
[wwwroot@zx20G ~]$ mkdir /app/appinfo/elsearch/
[wwwroot@zx20G ~]$ groupadd elsearch;
[wwwroot@zx20G ~]$ useradd elsearch -g elsearch -p elsearch;
[wwwroot@zx20G ~]$ chown -R elsearch:elsearch /app/appinfo/elsearch;
[wwwroot@zx20G ~]$ su elsearch;
[wwwroot@zx20G ~]$ cd /app/appinfo/elsearch;
[elsearch@zx20G elsearch]$ tar zxvf elasticsearch-5.6.8.tar.gz
[elsearch@zx20G elsearch]$ cd elasticsearch-5.6.8/config
[elsearch@zx20G config]$ vim elasticsearch.yml
---------------------------- -start------------------------------
cluster.name: elk_test.cluster
node.name: esNode2
node.master: true
node.data: true
path.data: /app/appinfo/elsearch/data/elasticsearch
path.logs: /app/appinfo/elsearch/logs/elasticsearch
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["es1","es2","es3"]
discovery.zen.minimum_master_nodes: 3
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
---------------------------- -end------------------------------
[elsearch@zx20G elasticsearch-5.6.8]$ ./bin/elasticsearch -d   -- 
[elsearch@zx20G elasticsearch-5.6.8]$ ss -lntp|grep java
LISTEN     0      128                      :::9300                    :::*      users:(("java",23277,141))
LISTEN     0      128                      :::9200                    :::*      users:(("java",23277,167))

xxx.xxx.2.175

[wwwroot@zx20G ~]$ egrep -v "^#|^$" /etc/security/limits.conf 
elsearch         soft    nproc           65536
elsearch         hard    nofile        65536 
[wwwroot@zx20G ~]$ egrep -v "^#|^$" /etc/sysctl.conf 
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.max_map_count = 262144 -- 
[wwwroot@zx20G ~]$ sysctl -p  -- 
[wwwroot@zx20G ~]$ mkdir /app/appinfo/elsearch/
[wwwroot@zx20G ~]$ groupadd elsearch;
[wwwroot@zx20G ~]$ useradd elsearch -g elsearch -p elsearch;
[wwwroot@zx20G ~]$ chown -R elsearch:elsearch /app/appinfo/elsearch;
[wwwroot@zx20G ~]$ su elsearch;
[wwwroot@zx20G ~]$ cd /app/appinfo/elsearch;
[elsearch@zx20G elsearch]$ tar zxvf elasticsearch-5.6.8.tar.gz
[elsearch@zx20G elsearch]$ cd elasticsearch-5.6.8/config
[elsearch@zx20G config]$ vim elasticsearch.yml
---------------------------- -start------------------------------
cluster.name: elk_test.cluster
node.name: esNode3
node.master: true
node.data: true
path.data: /app/appinfo/elsearch/data/elasticsearch
path.logs: /app/appinfo/elsearch/logs/elasticsearch
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["es1","es2","es3"]
discovery.zen.minimum_master_nodes: 3
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
---------------------------- -end------------------------------
[elsearch@zx20G elasticsearch-5.6.8]$ ./bin/elasticsearch -d   -- 
[elsearch@zx20G elasticsearch-5.6.8]$ ss -lntp|grep java
LISTEN     0      128                      :::9300                    :::*      users:(("java",23277,141))
LISTEN     0      128                      :::9200                    :::*      users:(("java",23277,167))

elasticsearch-head 설치


xxx에 설치합니다.xxx.2.172

mkdir /opt/es/node -p
cd /opt/es/node
wget https://npm.taobao.org/mirrors/node/v8.1.4/node-v8.1.4-linux-x64.tar.gz
tar xf node-v8.1.4-linux-x64.tar.gz
vim /etc/profile------->    
export NODE_HOME=/opt/es/node/node-v8.1.4-linux-x64
export PATH=$NODE_HOME/bin:$PATH
source /etc/profile( )
node -v
 node 
v8.1.4
npm -v
 npm 
5.0.3
cd ( /root )
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
yum -y install unzip
unzip master.zip
npm install------> 
Error making request.
Error: connect ETIMEDOUT 13.250.177.223:443
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:14)

Please report this full log at https://github.com/Medium/phantomjs
npm WARN [email protected] license should be a valid SPDX license expression

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-04-02T14_39_31_812Z-debug.log
 
 npm install [email protected] --ignore-scripts
 npm install 
[root@es1 elasticsearch-head-master]# npm install grunt-cli
npm WARN [email protected] license should be a valid SPDX license expression

+ [email protected]
added 1 package in 14.302s
[root@es1 ~]# vim /root/.bashrc 

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
export PATH=/root/elasticsearch-head-master/node_modules/grunt-cli/bin:$PATH
 . /root/.bashrc
 vim elasticsearch-head-master/Gruntfile.js
  connect: {
                        server: {
                                options: {
                                        port: 9100,
                                        hostname: '0.0.0.0',
                                        base: '.',
                                        keepalive: true
                                }
                        }
                }
 vim elasticsearch-head-master/_site/app.js 
  this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.0.11.37:9200";
 cd elasticsearch-head-master/
 npm install
 nohup  grunt server &
 etstat -antulp | grep :9100 9100 

좋은 웹페이지 즐겨찾기