1,三台阿里云服务器,1核2G内存,特别注意性能突发性的服务器内存至少要2G,否则ES启动会因为内存不足而失败。
2,ES版本:7.2。
3,kibana版本:7.2。
wget -c https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0-x86_64.rpm
sudo rpm --install elasticsearch-7.2.0-x86_64.rpm
因为并非解压式安装,目录比较分散,关注两个即可:配置文件目录和命令目录
cd /etc/elasticsearch/
cd /usr/share/elasticsearch/
注意阿里云1G内存的服务器可能跑不起来es7.2,我尝试过腾讯的可以。但因为我之前有几台阿里云的服务器,所以最后还是选择了阿里云服务器
sudo vim /etc/elasticsearch/jvm.options
-Xms1g
-Xmx1g
4.1 master配置
--1,cluster配置部分
cluster.name: geek4es
node.master: true
node.data: true
--2, node配置部分,这里的node-1是主机名,可以在/etc/hostname中修改
node.name: node-1
--3, network部分
#
#Set the bind address to a specific IP (IPv4 or IPv6):
# 很多人说这里配成0.0.0.0后,外网可以访问,否则外网不能访问。其实不然,下面配的是阿里内部ip,通# 过外网也能访问es
network.host: 172.31.213.69
#
#Set a custom port for HTTP:
#
http.port: 9200
#
#For more information, consult the network module documentation.
#允许跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
--4, Discovery部分
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#配置master节点
cluster.initial_master_nodes: ["172.31.213.69"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
4.2 slave节点配置
--1,cluster配置部分
cluster.name: geek4es
node.master: false
node.data: true
--2, node配置部分,这里的node-2是主机名,可以在/etc/hostname中修改
node.name: node-2
--3, network部分
#
#Set the bind address to a specific IP (IPv4 or IPv6):
# 这里要配成0.0.0.0后,否则无法成功启动加入集群
network.host: 0.0.0.0
#
#Set a custom port for HTTP:
#
http.port: 9200
#
#For more information, consult the network module documentation.
#允许跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
--4, Discovery部分
# --------------------------------- Discovery ----------------------------------
# 这里配置master结点的地址,es启动后会自动加入这个master所在的集群,要和master节点的
# cluster.initial_master_nodes配置保持一致
discovery.seed_hosts: ["172.31.213.69:9300"]
/usr/share/elasticsearch/bin/elasticsearch
curl 'http://localhost:9200/?pretty'
curl "http://node-1:9200/_cluster/health?pretty=true"
1,不能用root用户启动,要新建非root用户
#创建用户组
groupadd es
#创建用户,-g指定用户组
useradd -g es eser
--给新增用户sudo权限
vi /etc/sudoers/
--在/etc/sudoers文件中新增下面这行
es ALL=(ALL) ALL
2,用新增用户启动时可能会遇到多个文件夹权限问题,根据具体的报错信息,逐次逐个修改文件权限:
--demo
chmod 777 -R /etc/elasticsearch
3,在加入集群前,es如果启动过,加入集群会失败,此时删掉esdata目录,重新启动即可成功。
--下载到~/app/下
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.2.0-linux-x86_64.tar.gz
tar -xvf kibana-7.2.0-linux-x86_64.tar.gz
mv kibana-7.2.0-linux-x86_64 /usr/local/src/kibana
cd /usr/local/src/kibana/kibana/config/kibana.yml
# Kibana is served by a back end server. This setting specifies the port to use.
server.port: 5601
# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "0.0.0.0"
# The URLs of the Elasticsearch instances to use for all your queries
# 这里要配es集群master节点的ip
elasticsearch.hosts: ["http://node-1:9200"]
/usr/local/src/kibana/kibana/bin/kibana
http://7.15.9.1:5601/
按步骤安装ES集群
wget https://github.com/lmenezes/cerebro/releases/download/v0.8.3/cerebro-0.8.3.tgz
mv cerebro /usr/local/src/cerebro/
tar -zxvf cerebro.tar.gz
./cerebro/bin/cerebro
http://4.5.4.31:9000/