|
CentOS7部署ElasticSearch-2.1.1集群
系统规划
主机名
| IP地址
| 系统版本
| 软件版本
| node160
| 192.168.1.160
| centos7
| ElasticSearch-2.1.1
| node161
| 192.168.1.161
| centos7
| ElasticSearch-2.1.1
| node162
| 192.168.1.162
| centos7
| ElasticSearch-2.1.1
|
所有节点检查java版本
[root@node160~]# java -version
javaversion "1.8.0_40"
Java(TM)SE Runtime Environment (build 1.8.0_40-b26)
JavaHotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
所有节点配置hosts文件
192.168.1.160 node160
192.168.1.161 node161
192.168.1.162 node162
所有节点安装ElasticSearch
[root@node160 ~]# mkdir /opt/elk
[root@node160~]# cd /opt/elk
[root@node160~]# wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.1/elasticsearch-2.1.1.tar.gz
[root@node160elk]# tar xf elasticsearch-2.1.1.tar.gz
创建启动elasticsearch用户
[root@node160bin]# groupadd elk
[root@node160bin]# useradd elk -g elk -p elasticsearch
[root@node162elk]# chown -R elk.elk elasticsearch-2.1.1
[root@node160elk]# passwd elk
更改用户 elk 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。启动elasticsearch
[root@node162elasticsearch-2.1.1]# su elk
[elk@node162elasticsearch-2.1.1]$ bin/elasticsearch
[2016-03-0714:53:09,636][INFO ][node ] [Sea Urchin] version[2.1.1], pid[1367],build[40e2c53/2015-12-15T13:05:55Z]
[2016-03-0714:53:09,636][INFO ][node ] [Sea Urchin] initializing ...
[2016-03-0714:53:09,796][INFO ][plugins ] [Sea Urchin] loaded [], sites []
[2016-03-0714:53:09,867][INFO ][env ] [Sea Urchin] using [1] data paths, mounts [[/ (rootfs)]], netusable_space [48.5gb], net total_space [49.9gb], spins? [unknown], types[rootfs]
[2016-03-0714:53:11,972][INFO ][node ] [Sea Urchin] initialized
[2016-03-0714:53:11,972][INFO ][node ] [Sea Urchin] starting ...
[2016-03-0714:53:12,289][INFO ][transport ] [Sea Urchin] publish_address {127.0.0.1:9300}, bound_addresses{127.0.0.1:9300}, {[::1]:9300}
[2016-03-0714:53:12,308][INFO ][discovery ] [Sea Urchin]elasticsearch/dJDdF4-sSdOsVsnzrEBk7g
[2016-03-0714:53:15,485][INFO ][cluster.service ] [Sea Urchin] new_master {SeaUrchin}{dJDdF4-sSdOsVsnzrEBk7g}{127.0.0.1}{127.0.0.1:9300}, reason:zen-disco-join(elected_as_master, [0] joins received)
[2016-03-0714:53:15,557][INFO ][http ] [Sea Urchin] publish_address {127.0.0.1:9200}, bound_addresses{127.0.0.1:9200}, {[::1]:9200}
[2016-03-0714:53:15,558][INFO ][node ] [Sea Urchin] started
[2016-03-0714:53:15,579][INFO ][gateway ] [Sea Urchin] recovered [0] indices into cluster_state
所有节点配置elk启动内存
[root@node160bin]# vi elasticsearch.in.sh
ES_MIN_MEM=32g
ES_MAX_MEM=32g
所有节点配置elk集群模式
[root@node160config]# vi elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
# ---------------------------------- Cluster -----------------------------------
cluster.name: elastic
# ------------------------------------ Node ------------------------------------
node.name: elastic160
#node.master: true
node.data: true
# ----------------------------------- Paths ------------------------------------
path.conf : /application/elasticsearch-2.1.1/config
path.data : /application/elasticsearch-2.1.1/data
path.logs : /application/elasticsearch-2.1.1/logs
path.plugins : /application/elasticsearch-2.1.1/plugins
path.work : /tmp
# ----------------------------------- Memory -----------------------------------
bootstrap.mlockall: true
# ---------------------------------- Http -----------------------------------
http.enabled: true
http.host: 192.168.1.160
http.bind_host: 192.168.1.160
http.publish_host: 192.168.1.160
http.port: 9200
http.max_content_length: 100mb
http.max_initial_line_length: 4kb
http.max_header_size: 8kb
http.compression: true
http.compression_level: 3
http.cors.max-age: 1728000
# ----------------------------------- Index -------------------------------------
index.number_of_shards: 5
index.number_of_replicas: 1
# ---------------------------------- Network -----------------------------------
# 关系推到: 通过network.host ----->network.bind_host ------>network.publish_host
network.host: 192.168.1.160
network.bind_host: 192.168.1.160
network.publish_host: 192.168.1.160
# ---------------------------------- Transport-----------------------------------
transport.host: 192.168.1.160
transport.bind_host: 192.168.1.160
transport.publish_host: 192.168.1.160
transport.tcp.connect_timeout: 10s
transport.ping_schedule: 2s
transport.tcp.port: 9300
transport.publish_port: 9300
transport.tcp.compress: true
# ---------------------------------- Descovery-----------------------------------
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elastic160", "elastic161","elastic162"]
discovery.zen.join_timeout: 3s
#配置当前集群中最少的主节点,对于多于两个节点的集群环境,建议配置大于1.
discovery.zen.minimum_master_nodes: 2
ping_interval: 1
ping_timeout: 15
ping_retries: 3
# ---------------------------------- Gateway -----------------------------------
gateway.recover_after_nodes: 3
# ---------------------------------- Various -----------------------------------
action.destructive_requires_name: true
[root@node161 config]# vi elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
# ---------------------------------- Cluster -----------------------------------
cluster.name: elastic
# ------------------------------------ Node ------------------------------------
node.name: elastic161
#node.master: true
node.data: true
# ----------------------------------- Paths ------------------------------------
path.conf : /application/elasticsearch-2.1.1/config
path.data : /application/elasticsearch-2.1.1/data
path.logs : /application/elasticsearch-2.1.1/logs
path.plugins : /application/elasticsearch-2.1.1/plugins
path.work : /tmp
# ----------------------------------- Memory -----------------------------------
bootstrap.mlockall: true
# ---------------------------------- Http -----------------------------------
http.enabled: true
http.host: 192.168.1.161
http.bind_host: 192.168.1.161
http.publish_host: 192.168.1.161
http.port: 9200
http.max_content_length: 100mb
http.max_initial_line_length: 4kb
http.max_header_size: 8kb
http.compression: true
http.compression_level: 3
http.cors.max-age: 1728000
# ----------------------------------- Index -------------------------------------
index.number_of_shards: 5
index.number_of_replicas: 1
# ---------------------------------- Network -----------------------------------
# 关系推到: 通过network.host ----->network.bind_host ------>network.publish_host
network.host: 192.168.1.161
network.bind_host: 192.168.1.161
network.publish_host: 192.168.1.161
# ---------------------------------- Transport-----------------------------------
transport.host: 192.168.1.161
transport.bind_host: 192.168.1.161
transport.publish_host: 192.168.1.161
transport.tcp.connect_timeout: 10s
transport.ping_schedule: 2s
transport.tcp.port: 9300
transport.publish_port: 9300
transport.tcp.compress: true
# ---------------------------------- Descovery-----------------------------------
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elastic160", "elastic161","elastic162"]
discovery.zen.join_timeout: 3s
#配置当前集群中最少的主节点,对于多于两个节点的集群环境,建议配置大于1.
discovery.zen.minimum_master_nodes: 2
ping_interval: 1
ping_timeout: 15
ping_retries: 3
# ---------------------------------- Gateway -----------------------------------
gateway.recover_after_nodes: 3
# ---------------------------------- Various -----------------------------------
action.destructive_requires_name: true
[root@node162 config]# vi elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
# ---------------------------------- Cluster -----------------------------------
cluster.name: elastic
# ------------------------------------ Node ------------------------------------
node.name: elastic162
#node.master: true
node.data: true
# ----------------------------------- Paths ------------------------------------
path.conf : /application/elasticsearch-2.1.1/config
path.data : /application/elasticsearch-2.1.1/data
path.logs : /application/elasticsearch-2.1.1/logs
path.plugins : /application/elasticsearch-2.1.1/plugins
path.work : /tmp
# ----------------------------------- Memory -----------------------------------
bootstrap.mlockall: true
# ---------------------------------- Http -----------------------------------
http.enabled: true
http.host: 192.168.1.162
http.bind_host: 192.168.1.162
http.publish_host: 192.168.1.162
http.port: 9200
http.max_content_length: 100mb
http.max_initial_line_length: 4kb
http.max_header_size: 8kb
http.compression: true
http.compression_level: 3
http.cors.max-age: 1728000
# ----------------------------------- Index -------------------------------------
index.number_of_shards: 5
index.number_of_replicas: 1
# ---------------------------------- Network -----------------------------------
# 关系推到: 通过network.host ----->network.bind_host ------>network.publish_host
network.host: 192.168.1.162
network.bind_host: 192.168.1.162
network.publish_host: 192.168.1.162
# ---------------------------------- Transport-----------------------------------
transport.host: 192.168.1.162
transport.bind_host: 192.168.1.162
transport.publish_host: 192.168.1.162
transport.tcp.connect_timeout: 10s
transport.ping_schedule: 2s
transport.tcp.port: 9300
transport.publish_port: 9300
transport.tcp.compress: true
# ---------------------------------- Descovery-----------------------------------
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elastic160", "elastic161","elastic162"]
discovery.zen.join_timeout: 3s
#配置当前集群中最少的主节点,对于多于两个节点的集群环境,建议配置大于1.
discovery.zen.minimum_master_nodes: 2
ping_interval: 1
ping_timeout: 15
ping_retries: 3
# ---------------------------------- Gateway -----------------------------------
gateway.recover_after_nodes: 3
# ---------------------------------- Various -----------------------------------
action.destructive_requires_name: true
所有节点安装ElasticSearch插件
head插件:
./plugin install mobz/elasticsearch-head
kosf插件
./plugin install lmenezes/elasticsearch-kopf/master
delete-by-query插件
./plugin install delete-by-query
所有节点启动elasticsearch
su elk -c "/opt/elk/elasticsearch-2.1.1/bin/elasticsearch & "
或者
su elk -c "/opt/elk/elasticsearch-2.1.1/bin/elasticsearch -d"
所有节点访问启动是否正常
http://192.168.1.160:9200
http://192.168.1.161:9200
http://192.168.1.162:9200

访问集群节点是否正常,使用head插件
http://192.168.1.160:9200/_plugin/head/
http://192.168.1.160:9200/_plugin/kopf/
|
|
|