2台5.X版本的作ES集群用于Skywalking服务调用链路跟踪管理
系统环境:centos7.5
es版本:elasticsearch-5
jdk:1.8
主机ip
192.168.2.129
192.168.2.130
1、软件下载
cd /usr/local/
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.tar.gz
2、jdk安装
wget ftp://10.249.100.249/pub/jdk/jdk8/*
3、安装es
tar -zxvf elasticsearch-5.6.3.tar.gz
mv elasticsearch-5.6.3/ elasticsearch
4、建立data目录和log目录
mkdir -p /data/elasticsearch/data
mkdir -p /data/elasticsearch/logs
5、建立用户(es不能用root运行)
useradd es
chown -R es:es /usr/local/elasticsearch
chown -R es:es /data
6、系统参数优化
vim /usr/local/elasticsearch/config/jvm.options
-Xms4g
-Xmx4g
vi /etc/sysctl.conf
vm.max_map_count=655360
fs.file-max=655360
vi /etc/security/limits.conf
es soft memlock unlimited
es hard memlock unlimited
7、编辑配置文件
[root@ip-192-168-2-129 ~]# grep '^[a-z]' /usr/local/elasticsearch/config/elasticsearch.yml
cluster.name: es5.6.3
node.name: node-129
node.master: true
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
bootstrap.memory_lock: true
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.2.129", "192.168.2.130"]
gateway.recover_after_nodes: 1
http.cors.enabled: true
http.cors.allow-origin: "*"
[root@ip-192-168-2-130 ~]# grep '^[a-z]' /usr/local/elasticsearch/config/elasticsearch.yml
cluster.name: es5.6.3
node.name: node-130
node.master: true
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
bootstrap.memory_lock: true
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.2.129", "192.168.2.130"]
gateway.recover_after_nodes: 1
http.cors.enabled: true
http.cors.allow-origin: "*"
8、启动
分别启动两台服务
su - es -c "/usr/local/elasticsearch/bin/elasticsearch &"
9、head插件安装
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
unzip elasticsearch-5.6.3.tar.gz
cd elasticsearch-head-master
10、安装node
curl -sL -o /etc/yum.repos.d/khara-nodejs.repo https://copr.fedoraproject.org/coprs/khara/nodejs/repo/epel-7/khara-nodejs-epel-7.repo
yum install -y nodejs nodejs-npm
11、安装grunt
cd /usr/lib/node_modules/npm/
npm install grunt-cli
npm install grunt
12、修改配置
修改vim Gruntfile.js文件:增加hostname属性,设置为*
connect: {
server: {
options: {
port: 9100,
hostname: '*',
base: '.',
keepalive: true
}
}
}
修改 vim _site/app.js 文件:修改head的连接地址
this.base_uri = this.config.base_uri || this.prefs.get(“app-base_uri”) || “http://localhost:9200“;
修改成ElasticSearch的机器地址
this.base_uri = this.config.base_uri || this.prefs.get(“app-base_uri”) || “http://192.168.2.130:9200“;
12、启动head
cd /usr/local/elasticsearch-head-master/node_modules/.bin
cd /usr/local/elasticsearch-head-master/node_modules/.bin/
./grunt server &
13、网页访问
http://192.168.2.129:9100
http://192.168.2.130:9100
如果出现集群连不上的状态:https://www.cnblogs.com/wendu/p/6549806.html
14、设置开机启动
su - es -c "/usr/local/elasticsearch/bin/elasticsearch -d"
cd /usr/local/elasticsearch-head-master/node_modules/.bin/
./grunt server &
==========================================
参考手册http://www.mamicode.com/info-detail-873117.html
https://blog.csdn.net/xshy3412/article/details/51841270
这个是两个节点http://www.bubuko.com/infodetail-1847606.html
https://blog.csdn.net/chenxun_2010/article/details/78437852