ubuntu 部署 ELK
作者:忙着长大#
- 2022-11-27 北京
本文字数:1758 字
阅读完需:约 6 分钟
内核参数优化
vm.max_map_count=262144
复制代码
增加主机名解析
192.168.131.131 es-node1
192.168.131.132 es-node2
192.168.131.133 es-node3
复制代码
资源 limit 优化
# cat /etc/security/limits.conf
# End of file
root soft core unlimited
root hard core unlimited
root soft nproc 1000000
root hard nproc 1000000
root soft nofile 1000000
root hard nofile 1000000
root soft memlock 32000
root hard memlock 32000
root soft msgqueue 8192000
root hard msgqueue 8192000
* soft core unlimited
* hard core unlimited
* soft nproc 1000000
* hard nproc 1000000
* soft nofile 1000000
* hard nofile 1000000
* soft memlock 32000
* hard memlock 32000
* soft msgqueue 8192000
* hard msgqueue 8192000
复制代码
创建普通⽤户运⾏环境
# groupadd -g 2888 elasticsearch && useradd elasticsearch -u 2888 -g 2888 -r -m -s /bin/bash
# password elasticsearch
root@es3:~# passwd elasticsearch
New password:
Retype new password:
passwd: password updated successfully
# mkdir -pv /data/esdata /data/eslogs /apps && chown elasticsearch.elasticsearch -R /data /apps/
复制代码
部署 elasticsearch 集群
# tar xvf elasticsearch-8.5.1-linux-x86_64.tar.gz && ln -sv /apps/elasticsearch-8.5.1 /apps/elasticsearch
# reboot
复制代码
xpack 认证签发环境
签发证书:
root@es1:~# su - elasticsearch
elasticsearch@es1:~$ cd /apps/elasticsearch
/apps/elasticsearch$ vim instances.yml
instances:
- name: "es1.example.com"
ip:
- "172.31.2.101"
- name: "es2.example.com"
ip:
- "172.31.2.102"
- name: "es3.example.com"
ip:
- "172.31.2.103"
#⽣成CA私钥,默认名字为elastic-stack-ca.p12
/apps/elasticsearch$ bin/elasticsearch-certutil ca
#⽣产CA公钥,默认名称为elastic-certificates.p12
/apps/elasticsearch$ bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
#签发elasticsearch集群主机证书:
elasticsearch@es1:/apps/elasticsearch$ bin/elasticsearch-certutil cert --silent --in
instances.yml --out certs.zip --pass magedu123 --ca elastic-stack-ca.p12 #指定证书密码为
magedu123
Enter password for CA (elastic-stack-ca.p12) : #CA私钥如果没有密码就直接按回⻋确认
证书分发:
#本机(node1)证书:
elasticsearch@es1:/apps/elasticsearch$ unzip certs.zip
elasticsearch@es1:/apps/elasticsearch$ mkdir config/certs
elasticsearch@es1:/apps/elasticsearch$ cp -rp es1.example.com/es1.example.com.p12
config/certs/
node2证书:
elasticsearch@es2:/apps/elasticsearch$ mkdir config/certs
elasticsearch@es1:/apps/elasticsearch$ scp -rp es2.example.com
172.31.2.102:/apps/elasticsearch/config/certs/
node3证书:
elasticsearch@es3:/apps/elasticsearch$ mkdir config/certs
elasticsearch@es1:/apps/elasticsearch$ scp -rp es3.example.com
172.31.2.103:/apps/elasticsearch/config/certs/
#⽣成 keystore ⽂件(keystore是保存了证书密码的认证⽂件magedu123)
elasticsearch@es1:/apps/elasticsearch$ ./bin/elasticsearch-keystore create #创建
keystore⽂件
Created elasticsearch keystore in /apps/elasticsearch/config/elasticsearch.keystore
elasticsearch@es1:/apps/elasticsearch$ ./bin/elasticsearch-keystore add
xpack.security.transport.ssl.keystore.secure_password
Enter value for xpack.security.transport.ssl.keystore.secure_password: #magedu123
elasticsearch@es1:/apps/elasticsearch$ ./bin/elasticsearch-keystore add
xpack.security.transport.ssl.truststore.secure_password
Enter value for xpack.security.transport.ssl.truststore.secure_password: #magedu123
分发认证⽂件:
node2:
elasticsearch@es1:/apps/elasticsearch$ scp -rp es2.example.com/es2.example.com.p12
172.31.2.102:/apps/elasticsearch/config/certs/
node3:
elasticsearch@es1:/apps/elasticsearch$ scp -rp es3.example.com/es3.example.com.p12
172.31.2.103:/apps/elasticsearch/config/certs/
复制代码
划线
评论
复制
发布于: 刚刚阅读数: 5
忙着长大#
关注
还未添加个人签名 2022-02-09 加入
还未添加个人简介
评论