Linux安装 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 elasticsearch-head@0.0.0 license should be a valid SPDX license expression

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 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 phantomjs-prebuilt@2.1.16 --ignore-scripts
 npm install 
[root@es1 elasticsearch-head-master]# npm install grunt-cli
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression

+ grunt-cli@1.2.0
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端口

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值