ElasticSearch下载安装
启动与关闭
./bin/elasticsearch -p /tmp/elasticsearch-pid -d
cat /tmp/elasticsearch-pid && echo
kill -SIGTERM pid
下载安装包
:wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.3-linux-x86_64.tar.gz
在/usr/local/elk/ 解压 tar -zxvf elasticsearch-linux-**.tar.gz
mv ** es
创建普通用户
useradd es
passwd es
Cvb&…
mkdir /data/es
mkdir /data/es/data
mkdir /data/es/logs
chown -R es:es /data/es
mkdir /usr/local/es/config/certs
chown -R es:es /usr/local/es
生成ssl证书, 密码访问
切换到es用户
su es
cd /usr/local/es
#生成CA证书
./bin/elasticsearch-certutil ca --out ./config/certs/elastic-stack-ca.p12 -pass(CA证书:elastic-stack-ca.p12)
设置默认名称:elastic-stack-ca.p12
设置密码: Cvb&…
#生成节点证书
./bin/elasticsearch-certutil cert --ca ./config/certs/elastic-stack-ca.p12 --out ./config/certs/elastic-certificates.p12 -pass (节点证书:elastic-certificates.p12)
设置默认名称:elastic-certificates.p12
设置密码:
把密码加到文件中
./bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
./bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
Cvb&…
对其他节点
scp root@192.103.25.195:/usr/local/elk/elasticsearch-8.3.3-linux-x86_64.tar.gz …/elk/
修改elasticsearch.yml
cluster.name: elasticsearch-cluster
node.name: es196
bootstrap.memory_lock: true
path.data: /data/es/data
path.logs: /data/es/logs
network.host: 192.103.25.195
http.port: 9200
transport.port: 9300
discovery.seed_hosts: [“192.103.25.192”, “192.103.25.193”, “192.103.25.194”, “192.103.25.195”]
cluster.initial_master_nodes: [“192.103.25.192”, “192.103.25.193”, “192.103.25.194”, “192.103.25.195”]
#Enable security features
#开启 xpack 身份验证
#xpack.security.enrollment.enabled: false
xpack.security.enabled: true
#开启 ssl 认证
xpack.security.transport.ssl.enabled: true
#ssl 证书模式
xpack.security.transport.ssl.verification_mode: certificate
#证书路径
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12
修改系统配置文件
切换到root用户
su root
最大可创建文件数太小====
vim /etc/security/limits.conf
在文件末尾中增加下面内容
es soft nofile 65536
es hard nofile 65536
es soft memlock unlimited
es hard memlock unlimited
vim /etc/security/limits.d/20-nproc.conf
在文件末尾中增加下面内容
es soft nofile 65536
es hard nofile 65536
=最大虚拟内存太小=====
vim /etc/sysctl.conf
在文件中增加下面内容
vm.max_map_count=655360
重新加载,输入下面命令:
sysctl -p
生成密码
./bin/elasticsearch-setup-passwords auto