ES的安装

版权声明:有一种生活不去经历不知其中艰辛,有一种艰辛不去体会,不会知道其中快乐,有一种快乐,没有拥有不知其中纯粹 https://blog.csdn.net/wwwzydcom/article/details/84997044

下载地址

Elasticsearch官网: https://www.elastic.co/products/elasticsearch

安装Elasticsearch(单节点Linux环境)

上传安装包

elasticsearch-5.2.2.tar.gz

elasticsearch-head-master.zip 图形化界面插件

node-v6.9.2-linux-x64.tar.gz 安装图形插件必备的环境

解压

[root@testnote01 software]# tar -zxvf elasticsearch-5.2.2.tar.gz -C /opt/module/

在/opt/module/elasticsearch-5.2.2路径下创建data和logs文件夹

[root@testnote01 elasticsearch-5.2.2]# mkdir data
[root@testnote01 elasticsearch-5.2.2]# mkdir logs

修改配置文件/opt/module/elasticsearch-5.2.2/config/elasticsearch.yml

	#配置集群名称,只要后面的节点名称一样会自动关联到集群
	cluster.name: my-application
	#
	# ------------------------------------ Node ------------------------------------
	#
	# Use a descriptive name for the node:
	#节点名称
	node.name: testnote01
	#数据的存储路径
	path.data: /opt/module/elasticsearch-5.2.2/data
	
	#日志的存储路径
	# Path to log files:
	#
	path.logs: /opt/module/elasticsearch-5.2.2/logs
	bootstrap.memory_lock: false
	bootstrap.system_call_filter: false
	
	network.host: 192.168.18.50
	discovery.zen.ping.unicast.hosts: ["testnote01"]

在这里插入图片描述
中间必须用空格,字体颜色发生变化

配置文件参数解析:

(1)cluster.name

如果要配置集群需要两个节点上的elasticsearch配置的cluster.name相同,都启动可以自动组成集群,这里如果不改cluster.name则默认是cluster.name=my-application

(2)nodename随意取但是集群内的各节点不能相同

(3)修改后的每行前面不能有空格,修改后的“:”后面必须有一个空格

配置linux系统环境(参考:http://blog.csdn.net/satiling/article/details/59697916)

root用户下,编辑limits.conf 添加类似如下内容

 vi /etc/security/limits.conf

# End of file
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

切换到root用户,进入limits.d目录下修改配置文件

vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048

切换到root用户修改配置sysctl.conf

[root@hadoop102 elasticsearch-5.2.2]# vi /etc/sysctl.conf 
添加下面配置:
vm.max_map_count=655360
并执行命令:
[root@hadoop102 elasticsearch-5.2.2]# sysctl -p
然后,重新启动elasticsearch,即可启动成功。

出现bug

[root@testnote01 elasticsearch-5.2.2]# bin/elasticsearch
[2018-12-14T08:10:48,065][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [testnote01] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

不能用root用户启动

解决方案

在root账号下

useradd es

将es的整个文件夹修改权限

[root@testnote01 module]$ chown -R es:es elasticsearch-5.2.2

切换到es账号.重启启动

参考博客地址
https://blog.csdn.net/showhilllee/article/details/53404042
网页访问

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/wwwzydcom/article/details/84997044
今日推荐