三节点实行。
|
从官网下载得到
elasticsearch-7.17.20-x86_64.rpm (适配SpringBoot 2.7.3)
elasticsearch-analysis-ik-7.17.18.zip
|
rpm -ivh elasticsearch-7.17.20-x86_64.rpm
|
mkdir /usr/share/elasticsearch/plugins/ik
|
unzip elasticsearch-analysis-ik-7.17.18.zip -d /usr/share/elasticsearch/plugins/ik
|
rm -rf /var/lib/elasticsearch 默认安装后生成,未运行前为空目录
|
找个大的目录做一下软连接
mkdir /data/elasticsearch/
ln -s /data/elasticsearch/ /var/lib/elasticsearch
chmod 777 -R /var/lib/elasticsearch
chmod 777 -R /data/elasticsearch
|
vim /usr/share/elasticsearch/plugins/ik/plugin-descriptor.properties
修改
elasticsearch.version=7.17.20 本来7.17.18 修改20即可,兼容
|
主节点实行:
|
集群版修改方式:
vim /etc/elasticsearch/elasticsearch.yml (记得保存)
cluster.name: es-cluster
node.name: node-1
network.host: xxx.xxx.xxx.xxx 具体呆板ip
discovery.seed_hosts: ["xxx.xxx.200.52", "xxx.xxx.201.52", "xxx.xxx.202.52"] 具体呆板ip
xpack.security.enabled: true 开启认证
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
cluster.initial_master_nodes: ["node-1"] 集群初始化节点
|
systemctl start elasticsearch
|
开启节点间加密传输
/usr/share/elasticsearch/bin/elasticsearch-certutil ca
回车两次,集群间都在内网,可以不使用证书密码。
/usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
回车三次
cp /usr/share/elasticsearch/elastic-certificates.p12 /etc/elasticsearch/
chmod 777 /etc/elasticsearch/elastic-certificates.p12
|
主节点向从节点发送数据
scp /etc/elasticsearch/elasticsearch.yml root@xxx.xxx.201.52:/etc/elasticsearch/
scp /etc/elasticsearch/elasticsearch.yml root@xxx.xxx.202.52:/etc/elasticsearch/
scp /etc/elasticsearch/elastic-certificates.p12 root@xxx.xxx.201.52:/etc/elasticsearch/
scp /etc/elasticsearch/elastic-certificates.p12 root@xxx.xxx.202.52:/etc/elasticsearch/
|
|
*******************仅主节点实行********************
创建用户
/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
y
重复 输入密码
|
systemctl enable elasticsearch.service
|
从节点实行
|
vim /etc/elasticsearch/elasticsearch.yml (记得保存)
修改node.name 为node-2和node-3
修改node.host为从节点实际的ip 如xxx.xxx.201.52
删除 cluster.initial_master_nodes
|
systemctl start elasticsearch
|
验证
浏览器访问
http://xxx.xxx.200.52:9200/_cat/nodes?v 换成具体ip
得到
|