实例1 操作
cd /home
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.2-linux-x86_64.tar.gz
tar -xzf elasticsearch-8.6.2-linux-x86_64.tar.gz
mv elasticsearch-8.6.2 elasticsearch
为elaticsearch创建用户并赋予相应权限
adduser es
passwd es
chown -R es:es elasticsearch
chmod 770 elasticsearch
设置
sysctl -w vm.max_map_count=262144
sysctl -p
sysctl vm.max_map_count
su es
启动
./bin/elasticsearch
CLRT + C 结束
修改
network.host: 192.168.0.1 去掉注释 定义主机ip
cluster.name: my-application #去掉注释 自定义集群名字
node.name: node-1 #去掉注释 自定义主机名
# cors
http.cors.enabled: true
http.cors.allow-origin: "*"
获取token,其他实例机器中使用
./bin/elasticsearch-create-enrollment-token -s node
eyJ2ZXIiOiI4LjYuMiIsImFkciI6WyIxNzIuMTYuNDguMTQ6OTIwMCJdLCJmZ3IiOiIyNjIwMDMzYTg4MTg0NjdmYTI4ZGJjOTQ4MmY2MWE1YjZmODMxNmE0YmEyMjFhMzVkYjEwMmZjNWVhZjY0Njg1Iiwia2V5IjoienU5TERZY0JhMlpXMU9zSFhOeng6LUZjVTB6SjhSeS01UHoyR3pLNWRDUSJ9
实例2 操作
cd /home
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.2-linux-x86_64.tar.gz
tar -xzf elasticsearch-8.6.2-linux-x86_64.tar.gz
mv elasticsearch-8.6.2 elasticsearch
为elaticsearch创建用户并赋予相应权限
adduser es
passwd es
chown -R es:es elasticsearch
chmod 770 elasticsearch
设置
sysctl -w vm.max_map_count=262144
sysctl -p
sysctl vm.max_map_count
su es
CLRT + C 结束
使用token 启动
./bin/elasticsearch --enrollment-token eyJ2ZXIiOiI4LjYuMiIsImFkciI6WyIxNzIuMTYuNDguMTQ6OTIwMCJdLCJmZ3IiOiIyNjIwMDMzYTg4MTg0NjdmYTI4ZGJjOTQ4MmY2MWE1YjZmODMxNmE0YmEyMjFhMzVkYjEwMmZjNWVhZjY0Njg1Iiwia2V5IjoienU5TERZY0JhMlpXMU9zSFhOeng6LUZjVTB6SjhSeS01UHoyR3pLNWRDUSJ9
CLRT + C 结束
修改
network.host: 192.168.0.2 去掉注释 定义主机ip
cluster.name: my-application #去掉注释 自定义集群名字
node.name: node-2 #去掉注释 自定义主机名
# cors
http.cors.enabled: true
http.cors.allow-origin: "*"
启动
./bin/elasticsearch
成功加入集群
实例3 操作
cd /home
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.2-linux-x86_64.tar.gz
tar -xzf elasticsearch-8.6.2-linux-x86_64.tar.gz
mv elasticsearch-8.6.2 elasticsearch
为elaticsearch创建用户并赋予相应权限
adduser es
passwd es
chown -R es:es elasticsearch
chmod 770 elasticsearch
设置
sysctl -w vm.max_map_count=262144
sysctl -p
sysctl vm.max_map_count
su es
CLRT + C 结束
使用token 启动
./bin/elasticsearch --enrollment-token eyJ2ZXIiOiI4LjYuMiIsImFkciI6WyIxNzIuMTYuNDguMTQ6OTIwMCJdLCJmZ3IiOiIyNjIwMDMzYTg4MTg0NjdmYTI4ZGJjOTQ4MmY2MWE1YjZmODMxNmE0YmEyMjFhMzVkYjEwMmZjNWVhZjY0Njg1Iiwia2V5IjoienU5TERZY0JhMlpXMU9zSFhOeng6LUZjVTB6SjhSeS01UHoyR3pLNWRDUSJ9
CLRT + C 结束
修改
network.host: 192.168.0.3 去掉注释 定义主机ip 0.0.0.0
cluster.name: my-application #去掉注释 自定义集群名字
node.name: node-2 #去掉注释 自定义主机名
# cors
http.cors.enabled: true
http.cors.allow-origin: "*"
启动
./bin/elasticsearch
成功加入集群
查看集群状态
[root@VM-48-14-centos elasticsearch]# curl -k -u elastic:rRSQn_HA306KchpliovC https://172.16.48.14:9200/_cat/nodes
172.16.48.17 46 95 0 0.06 0.21 0.12 cdfhilmrstw - node-2
172.16.48.14 43 96 1 0.00 0.00 0.03 cdfhilmrstw * node-1
安装分词器
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.6.1/elasticsearch-analysis-ik-8.6.1.zip