Elastaticsearch 集群部署
阅读原文时间:2023年08月09日阅读:3

主机名称

IP

es-n1

192.168.175.76

es-n2

192.168.175.77

es-n3

192.168.175.78

kibana

192.168.175.79

安装JDK

apt install -y default-jdk

在ES三台机器下载并安装

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.9.deb
dpkg -i elasticsearch-5.6.9.deb

分别再ES三台机器安装X-Pack插件

cd /usr/share/elasticsearch/
./bin/elasticsearch-plugin install x-pack

修改ES配置文件

root@es-n1:/usr/share/elasticsearch# cat /etc/elasticsearch/elasticsearch.yml | grep -v '^#' | grep -v '#$'
cluster.name: es-cluster   #集群名唯一
node.name: es-n1           #节点名
path.data: /path/to/data
path.logs: /path/to/logs
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping_timeout: 30s
client.transport.ping_timeout: 30s
discovery.zen.ping.unicast.hosts: ["192.168.175.76","192.168.175.77","192.168.175.78"]

修改ES密码

默认用户名为:elastic 默认密码为:changeme

修改密码

curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456"}'

验证

查看集群状态

root@es-n1:~# curl -u elastic:123456 http://127.0.0.1:9200/_cat/nodes?v
ip             heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.175.78            5          97   3    0.08    0.03     0.01 mdi       -      es-n3
192.168.175.77           13          95   3    0.19    0.13     0.05 mdi       *      es-n2
192.168.175.76           10          96   1    0.12    0.10     0.06 mdi       -      es-n1

安装kibana

wget https://artifacts.elastic.co/downloads/kibana/kibana-5.6.9-amd64.deb
dpkg -i kibana-5.6.9-amd64.deb

修改kibana配置文件

root@kibana:~# cat /etc/kibana/kibana.yml | grep -v '^#' | grep -v '^$'
server.host: "0.0.0.0"
elasticsearch.url: "http://192.168.175.77:9200"
elasticsearch.username: "elastic"
elasticsearch.password: "khwyHtsa@0603"

重启服务器

访问 http://192.168.175.79:5601 访问成功会要求输入账号名密码