主機名 | IP | 操做系統 | ES 版本 |
---|---|---|---|
test1 | 192.168.1.2 | CentOS7.5 | 7.0.1 |
test2 | 192.168.1.3 | CentOS7.5 | 7.0.1 |
test3 | 192.168.1.4 | CentOS7.5 | 7.0.1 |
下載:css
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-linux-x86_64.tar.gz
或者到官網自行下載:https://www.elastic.co/cn/downloads/elasticsearch
useradd -m elastic
cd /var/lib
mkdir elasticsearch chown elastic.elastic elasticsearch
cd /var/log mkdir -p elasticsearch chown elastic.elastic elasticsearch
vm.max_map_count = 262144
elastic soft nofile 65536 elastic hard nofile 65536 elastic soft memlock unlimited elastic hard memlock unlimited
chown -R elastic.elastic /opt/elasticsearch
cluster.name: TEST_ES_CLUSTER node.name: test1 network.host: 192.168.1.2
cluster.initial_master_nodes: ["test1", "test2"] path.data: /var/lib/elasticsearch path.logs: /var/log/elasticsearch bootstrap.memory_lock: true discovery.zen.ping.unicast.hosts: ["192.168.1.2", "192.168.1.3", "192.168.1.4"] discovery.zen.minimum_master_nodes: 2 gateway.recover_after_nodes: 2
# test2 node.name: test2 network.host: 192.168.1.3 # test3 node.name: test3 network.host: 192.168.1.4
su - elastic -c '/opt/elasticsearch/bin/elasticsearch -d'
[Unit] Description=ElasticSearch Requires=network.service After=network.service [Service] User=elastic Group=elastic LimitNOFILE=65536 LimitMEMLOCK=infinity Environment=JAVA_HOME=/opt/jre ExecStart=/opt/elasticsearch/bin/elasticsearch SuccessExitStatus=143 [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl start elasticsearch
# 查看節點狀態 curl http://192.168.1.2:9200/_cat/nodes?pretty # 查看集羣狀態 curl http://192.168.1.2:9200/_cluster/state?pretty
su - elastic
/opt/elasticsearch/bin/elasticsearch-plugin install file:///elasticsearch-analysis-ik-7.0.1.zip
# vim /opt/jre/lib/security/java.policy,在最後一個 "}" 前追加下面一行 permission java.net.SocketPermission "*:*","accept,connect,resolve";