您的位置:首页 > 运维架构 > Linux

CentOS 7.3 安装ElasticSearch5.6.1步骤

2017-09-21 16:58 501 查看
1.准备并安装好CentOS系统(本文是在Vmware下安装,配置的硬件信息是双核4G内存),下载链接如下:

CentOS: https://www.centos.org/download/
2.用户设置,如果当前默认登录root用户,需要创建一个普通用户(ES5.x以后版本不支持root下启动):

添加用户es,所属root组密码test123

>useradd es -g root -p test123

3. 下载ElasticSearch包,链接如下:

>wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.1.zip
>unzip elasticsearch-5.6.1.zip



4.解压elasticsearch-5.6.1.zip至/home/es/目录下,并给目录elasticsearch-5.6.1赋es权限

>chown -R es:root elasticsearch-5.6.1



5.安装java:

>yum install java -y

 

6.在root用户下操作:

>vi /etc/security/limits.conf 

添加如下内容:

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

保存退出.

>vim /etc/security/limits.d/20-nproc.conf

修改如下内容:

* soft nproc 4096

#修改为

* soft nproc 2048

修改配置sysctl.conf

>vi /etc/sysctl.conf 

添加下面配置:

vm.max_map_count=655360

并执行命令:

>sysctl -p

修改yml配置文件:

> vim config/elasticsearch.yml

修改bind address: 

network.host: 0.0.0.0

6.启动es:

>cd /home/es/elasticsearch-5.6.1/

>su es

> ./bin/elasticsearch

 

显示如下信息说明安装成功:

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module[aggs-matrix-stats]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module [ingest-common]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module[lang-expression]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module [lang-groovy]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module [lang-mustache]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module [lang-painless]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module [parent-join]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module [percolator]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module [reindex]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module[transport-netty3]

[2017-09-21T01:26:28,877][INFO ][o.e.p.PluginsService     ] [9dhujIO] loaded module[transport-netty4]

[2017-09-21T01:26:28,878][INFO ][o.e.p.PluginsService     ] [9dhujIO] no plugins loaded

[2017-09-21T01:26:30,574][INFO ][o.e.d.DiscoveryModule    ] [9dhujIO] using discovery type [zen]

[2017-09-21T01:26:31,258][INFO ][o.e.n.Node               ] initialized

[2017-09-21T01:26:31,258][INFO ][o.e.n.Node               ] [9dhujIO] starting ...

[2017-09-21T01:26:31,455][INFO ][o.e.t.TransportService   ] [9dhujIO] publish_address {127.0.0.1:9300},bound_addresses {127.0.0.1:9300}

[2017-09-21T01:26:31,467][WARN ][o.e.b.BootstrapChecks    ] [9dhujIO] max file descriptors [4096] forelasticsearch process is too low, increase to at least [65536]

[2017-09-21T01:26:34,555][INFO ][o.e.c.s.ClusterService   ] [9dhujIO] new_master{9dhujIO}{9dhujIOFR9-vaVR2ZLjhSw}{iN4sZh8PRdmOrDvUir7pXQ}{127.0.0.1}{127.0.0.1:9300},reason: zen-disco-elected-as-master ([0] nodes joined)

[2017-09-21T01:26:34,646][INFO ][o.e.g.GatewayService     ] [9dhujIO] recovered [0] indices intocluster_state

[2017-09-21T01:26:34,649][INFO][o.e.h.n.Netty4HttpServerTransport] [9dhujIO] publish_address{127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}

[2017-09-21T01:26:34,649][INFO ][o.e.n.Node               ] [9dhujIO] started

 

7.用curl检查是否连接成功或浏览器连接http://localhost:9200:

>curl localhost:9200

{

  "name" :"9dhujIO",

 "cluster_name" : "elasticsearch",

 "cluster_uuid" : "PeP7JMg7R9mAvU6suUPJNw",

  "version": {

    "number": "5.6.1",

   "build_hash" : "667b497",

   "build_date" : "2017-09-14T19:22:05.189Z",

   "build_snapshot" : false,

   "lucene_version" : "6.6.1"

  },

  "tagline": "You Know, for Search"

}

 

8.设置防火墙端口9200,9300例外:

>systemctl start firewalld.service

>systemctl enable firewalld.service

>systemctl status firewalld.service

>firewall-cmd --permanent --add-port={9200/tcp,9300/tcp}

>firewall-cmd --reload

>firewall-cmd --state

>firewall-cmd --list-all 


9. 配置ElasticSearch后台运行

>./bin/elasticsearch -d

若启动出现错误根据信息去度娘或谷哥搜一下吧 ,好运~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ElasticSearch CentOS