https://www.elastic.co/cn/downloads/elasticsearch
一、elasticsearch 9300 9200的协议不同:
1、9200作为Http协议,主要用于外部通讯。
2、9300作为Tcp协议,jar之间就是通过tcp协议通讯。
3、ES集群之间是通过9300进行通讯。
1. 上传,解压
tar -zxvf elasticsearch-5.6.14.tar.gz -C /home2.创建用户
adduser elasticsearch修改用户密码:UC#Eq^eQ8!D@@Xft
passwd elasticsearch
3.创建数据,日志目录
mkdir -pv /home/elasticsearch-5.6.14/datamkdir -pv /home/elasticsearch-5.6.14/logs
4.授权
将ES所解压的目录授予此对应的用户chown -R elasticsearch:elasticsearch /home/elasticsearch-5.6.14
5.系统配置
编辑vi /etc/security/limits.conf,追加以下内容;# 设置当前ES用户的最大文件数(这里也可以使用*,表示所有的用户)
echo "* soft nproc 65536" >> /etc/security/limits.conf
echo "* hard nproc 65536" >> /etc/security/limits.conf
echo "* soft nofile 65536" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf
修改配置文件sysctl.conf
vi /etc/sysctl.conf
# 修改下述配置, 如果没有就在文件末尾添加:
echo "vm.max_map_count=655360" >> /etc/sysctl.conf
# 执行命令使修改生效:
sysctl -p
vim /home/elasticsearch-5.6.14/config/jvm.options
可以发现该文件路径,打开编辑,最上面就能看到内存控制参数-Xms5g 比较合理,内存的一半
-Xmx5g
根据服务器内存进行修改
6.修改配置文件elasticsearch.yml
(3台稍不同)vim /home/elasticsearch-5.6.14/config/elasticsearch.yml
添加以下内容:
cluster.name: myes
node.name: node_01
path.data: /home/elasticsearch-5.6.14/data
path.logs: /home/elasticsearch-5.6.14/logs
network.host: 192.161.0.241
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.161.0.241","192.161.0.245","192.161.0.246"]
bootstrap.system_call_filter: false
bootstrap.memory_lock: false
http.cors.enabled: true
http.cors.allow-origin: "*"
注:cluster.name: myes
myes(自定义) 和canal保持一致
node.name: node_01 (自定义)
--------------------------------------------------------------------------------------------------------------
cluster.name: myes
node.name: node_02
path.data: /home/elasticsearch-5.6.14/data
path.logs: /home/elasticsearch-5.6.14/logs
network.host: 192.161.0.245
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.161.0.241","192.161.0.245","192.161.0.246"]
bootstrap.system_call_filter: false
bootstrap.memory_lock: false
http.cors.enabled: true
http.cors.allow-origin: "*"
--------------------------------------------------------------------------------------------------------------
cluster.name: myes
node.name: node_03
path.data: /home/elasticsearch-5.6.14/data
path.logs: /home/elasticsearch-5.6.14/logs
network.host: 192.161.0.246
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.161.0.241","192.161.0.245","192.161.0.246"]
bootstrap.system_call_filter: false
bootstrap.memory_lock: false
http.cors.enabled: true
http.cors.allow-origin: "*"
7.启动
su elasticsearch./elasticsearch-5.6.14/bin/elasticsearch -d
ps aux |grep elasticsearch
ss -antp |grep 9200
8.验证集群
### 这个时候我们访问下接口来测试部署:
curl http://192.161.0.241:9200
curl http://192.161.0.245:9200
curl http://192.161.0.246:9200
[root@a36-hl-qjhlzf-mq home]# curl http://192.161.0.241:9200
{
"name" : "node_01",
"cluster_name" : "myes",
"cluster_uuid" : "KRlf8HeNRzS8qOLmFeM-_A",
"version" : {
"number" : "5.6.14",
"build_hash" : "f310fe9",
"build_date" : "2018-12-05T21:20:16.416Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
9.导入索引,验证索引,查看子目录
标签:14,5.6,192.161,集群,home,elasticsearch,安装,name From: https://www.cnblogs.com/xgsh/p/16636423.html