5、安装部署elasticsearch集群
5.1分别在三台服务器安装:
172.16.8.206 ops-elk06
172.16.8.207 ops-elk07
172.16.8.208 ops-elk08
5.2安装完Java
yum -y install java
java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
5.3elasticsearch集群安装
rpm -ivh elasticsearch-2.4.1.rpm
systemctl enable elasticsearch.service
systemctl start elasticsearch.service
5.4修改配置文件
-------------------------------------------------------------------------------------------
修改ES配置文件172.16.8.206 ops-elk06
mkdir -p /data/elasticsearch/{data,logs}
chown -R elasticsearch.elasticsearch /data/elasticsearch/
grep -n '^[a-Z]' /etc/elasticsearch/elasticsearch.yml
17:cluster.name: app-elk
23:node.name: ops-elk06
33:path.data: /data/elasticsearch/data
37:path.logs: /data/elasticsearch/logs
43:bootstrap.memory_lock: true
54:network.host: 0.0.0.0
58:http.port: 9200
68:discovery.zen.ping.unicast.hosts: ["172.16.8.207", "172.16.8.208"]
72:discovery.zen.minimum_master_nodes: 3
修改ES配置文件172.16.8.207 ops-elk07
grep -n '^[a-Z]' /etc/elasticsearch/elasticsearch.yml
17:cluster.name: app-elk
23:node.name: ops-elk07
33:path.data: /data/elasticsearch/data
37:path.logs: /data/elasticsearch/logs
43:bootstrap.memory_lock: true
54:network.host: 0.0.0.0
58:http.port: 9200
68:discovery.zen.ping.unicast.hosts: ["172.16.8.206", "172.16.8.208"]
72:discovery.zen.minimum_master_nodes: 3
修改ES配置文件172.16.8.208 ops-elk08
grep -n '^[a-Z]' /etc/elasticsearch/elasticsearch.yml
17:cluster.name: app-elk
23:node.name: ops-elk08
33:path.data: /data/elasticsearch/data
37:path.logs: /data/elasticsearch/logs
43:bootstrap.memory_lock: true
54:network.host: 0.0.0.0
58:http.port: 9200
68:discovery.zen.ping.unicast.hosts: ["172.16.8.206", "172.16.8.207"]
72:discovery.zen.minimum_master_nodes: 3
-------------------------------------------------------------------------------------------
5.5安装插件
/usr/share/elasticsearch/bin/plugin list
/usr/share/elasticsearch/bin/plugin install license
/usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head
/usr/share/elasticsearch/bin/plugin install lmenezes/elasticsearch-kopf
/usr/share/elasticsearch/bin/plugin install marvel-agent
安装bigdesk 插件
cd /usr/share/elasticsearch/plugins
mkdir bigdesk
cd bigdesk/
git clone https://github.com/lukas-vlcek/bigdesk _site
sed -i '142s/==/>=/' _site/js/store/BigdeskStore.js
cat >plugin-descriptor.properties<<EOF
description=bigdesk - Live charts and statistics for Elasticsearch cluster.
version=2.5.1
site=true
name=bigdesk
EOF
:9200
:9200
:9200
:9200/_plugin/head/
:9200/_plugin/head/
:9200/_plugin/head/
:9200/_plugin/kopf/#!/cluster
:9200/_plugin/kopf/#!/cluster
:9200/_plugin/kopf/#!/cluster
:9200/_plugin/bigdesk/
查看集群状态:curl -XGET :9200/_cat/health?v
查看集群节点:curl -XGET :9200/_cat/nodes?v
查询索引列表:curl -XGET :9200/_cat/indices?v
创建索引:curl -XPUT :9200/customer?pretty
查询索引:curl -XGET :9200/customer/external/1?pretty
删除索引:curl -XDELETE :9200/customer?pretty