标签:host ice lang 定义 add comment -bash dir chown
单机情况下安装伪分布式的es服务。首先配置之前已安装好的es服务的配置文件
[root@zsls elasticsearch-head-master]# cd /usr/local/elasticsearch-5.6.10/
[root@zsls elasticsearch-5.6.10]# ls
bin config data lib LICENSE.txt logs modules NOTICE.txt plugins README.textile
[root@zsls elasticsearch-5.6.10]# cd config/
[root@zsls config]# ls
elasticsearch.yml jvm.options log4j2.properties scripts
[root@zsls config]# vim elasticsearch.yml # 在文件末尾加入如下内容
cluster.name: es
node.name: master
node.master: true
参数说明:
cluster.name 集群的名称,可自定义
node.name 节点的名称,可自定义
node.master 是否指定为master角色
新建一个存放slave的目录,拷贝es压缩包到该目录中并解压,然后再拷贝多一份slave,最后还需要更改es_slave目录的所属用户及用户组为elsearch
[root@zsls config]# mkdir /usr/local/es_slave
[root@zsls config]# cp /usr/local/src/elasticsearch-5.6.10.tar.gz /usr/local/es_slave/
[root@zsls config]# cd /usr/local/es_slave/
[root@zsls es_slave]# tar -zxvf elasticsearch-5.6.10.tar.gz
[root@zsls es_slave]# mv elasticsearch-5.6.10 ./es_slave1
[root@zsls es_slave]# cp -r ./es_slave1/ es_slave2/
[root@zsls es_slave]# cd ../
[root@zsls local]# chown -R elsearch:elsearch es_slave/
逐个修改slave的配置文件
[root@zsls local]# cd /usr/local/es_slave/
[root@zsls es_slave]# vim es_slave1/config/elasticsearch.yml
cluster.name: es
node.name: slave1
network.host: 127.0.0.1
http.port: 8200
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
[root@zsls es_slave]# vim es_slave2/config/elasticsearch.yml
cluster.name: es
node.name: slave2
network.host: 127.0.0.1
http.port: 7200
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
开放端口
[root@zsls es_slave]# firewall-cmd --zone=public --add-port=8200/tcp --permanent
success
[root@zsls es_slave]# firewall-cmd --zone=public --add-port=7200/tcp --permanent
success
[root@zsls es_slave]# firewall-cmd --reload
success
[root@zsls es_slave]#
切换到elsearch用户中重启master节点,并启动其他两个slave节点
[elsearch@zsls es_slave]$ ps aux | grep elastic
开启则kill掉进程
[elsearch@zsls es_slave]$ cd /usr/local/elasticsearch-5.6.10/
[elsearch@zsls elasticsearch-5.6.10]$ sh bin/elasticsearch -d
[elsearch@zsls ~]$ sh /usr/local/es_slave/es_slave1/bin/elasticsearch -d
[elsearch@zsls ~]$ sh /usr/local/es_slave/es_slave2/bin/elasticsearch -d
启动es-head
[root@localhost ~]# cd /usr/local/elasticsearch-head-master/
[root@zsls elasticsearch-head-master]# npm run start
访问 服务器ip:端口 http://192.168.217.150:9100/
标签:host ice lang 定义 add comment -bash dir chown
原文地址:https://www.cnblogs.com/zk1023/p/10193513.html