首页 > 代码库 > Elasticsearch5.1.1集群安装部署

Elasticsearch5.1.1集群安装部署

1、准备环境

两台机器ip规划:

主机IP
node-33
192.168.2.33
node-34
192.168.2.34

2、安装JDK

sed -i.ori ‘$a export JAVA_HOME=/data/jdk\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar‘/etc/profile
. /etc/profile

3、sudo授权:(elasticseatch只能普通用户执行)

sed -ir ‘99 i elasticsearch   ALL=(ALL)      NOPASSWD: ALL‘ /etc/sudoers

 4、修改集群配置config/elasticsearch.yml

node-33:

[elasticsearch@node-1 config]$ grep "^[a-z]" elasticsearch.yml 
cluster.name: my-application
node.name: node-33
node.master: true
node.data: true
network.host: 192.168.2.33
http.port: 9200
http.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"

node-44:

[elasticsearch@node-2 config]$ grep "^[a-z]" elasticsearch.yml 
cluster.name: my-application
node.name: node-34
node.master: false
node.data: true
network.host: 192.168.2.34
http.port: 9200
http.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.ping.unicast.hosts: ["192.168.2.33", "192.168.2.34"]

5、启动服务

技术分享

本文出自 “shenghui” 博客,请务必保留此出处http://shenghui.blog.51cto.com/9717234/1889726

Elasticsearch5.1.1集群安装部署