ElasticSearch 伪分布式安装

Posted zk1023

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ElasticSearch 伪分布式安装相关的知识,希望对你有一定的参考价值。

单机情况下安装伪分布式的es服务。首先配置之前已安装好的es服务的配置文件

[[email protected] elasticsearch-head-master]# cd /usr/local/elasticsearch-5.6.10/
[[email protected] elasticsearch-5.6.10]# ls
bin config data lib LICENSE.txt logs modules NOTICE.txt plugins README.textile
[[email protected] elasticsearch-5.6.10]# cd config/
[[email protected] config]# ls
elasticsearch.yml jvm.options log4j2.properties scripts
[[email protected] config]# vim elasticsearch.yml     # 在文件末尾加入如下内容

cluster.name: es
node.name: master
node.master: true

参数说明:

  cluster.name 集群的名称,可自定义

  node.name 节点的名称,可自定义

  node.master 是否指定为master角色

 

新建一个存放slave的目录,拷贝es压缩包到该目录中并解压,然后再拷贝多一份slave,最后还需要更改es_slave目录的所属用户及用户组为elsearch

[[email protected] config]# mkdir /usr/local/es_slave
[[email protected] config]# cp /usr/local/src/elasticsearch-5.6.10.tar.gz /usr/local/es_slave/
[[email protected] config]# cd /usr/local/es_slave/

[[email protected] es_slave]# tar -zxvf elasticsearch-5.6.10.tar.gz

[[email protected] es_slave]# mv elasticsearch-5.6.10 ./es_slave1

[[email protected] es_slave]# cp -r ./es_slave1/ es_slave2/

[[email protected] es_slave]# cd ../
[[email protected] local]# chown -R elsearch:elsearch es_slave/

逐个修改slave的配置文件

[[email protected] local]# cd /usr/local/es_slave/
[[email protected] es_slave]# vim es_slave1/config/elasticsearch.yml

cluster.name: es

node.name: slave1

network.host: 127.0.0.1

http.port: 8200

discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

[[email protected] es_slave]# vim es_slave2/config/elasticsearch.yml

cluster.name: es

node.name: slave2

network.host: 127.0.0.1

http.port: 7200

discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

 

开放端口

[[email protected] es_slave]# firewall-cmd --zone=public --add-port=8200/tcp --permanent
success
[[email protected] es_slave]# firewall-cmd --zone=public --add-port=7200/tcp --permanent
success
[[email protected] es_slave]# firewall-cmd --reload
success
[[email protected] es_slave]#

切换到elsearch用户中重启master节点,并启动其他两个slave节点

[[email protected] es_slave]$ ps aux | grep elastic

开启则kill掉进程

[[email protected] es_slave]$ cd /usr/local/elasticsearch-5.6.10/
[[email protected] elasticsearch-5.6.10]$ sh bin/elasticsearch -d

[[email protected] ~]$ sh /usr/local/es_slave/es_slave1/bin/elasticsearch -d

[[email protected] ~]$ sh /usr/local/es_slave/es_slave2/bin/elasticsearch -d

启动es-head

[[email protected] ~]# cd /usr/local/elasticsearch-head-master/

[[email protected] elasticsearch-head-master]# npm run start

访问 服务器ip:端口    http://192.168.217.150:9100/

 

 




















以上是关于ElasticSearch 伪分布式安装的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu12.04+Elasticsearch2.3.3伪分布式配置,集群状态分片调整

elasticsearch代码片段,及工具类SearchEsUtil.java

ElasticSearch IK 分词器快速上手

ZooKeeper伪分布集群安装及使用 RMI+ZooKeeper实现远程调用框架

Flink的安装和部署--伪分布模式

hadoop2.7.3伪分布式环境搭建详细安装过程