Centos下安装elasticsearch-5.5.0
**
elasticsearch搭建
**
1、环境变量
搭建elasticsearch-5.5.0版本,根据网上资料说最低需要jdk8版本以上
确定jdk版本,如果没有安装jdk,请先安装。
2、安装软件包
我用的是elasticsearch-5.5.0.tar.gz
解压包到指定位置
tar xvf elasticsearch-5.5.0.tar.gz -C /usr/local/hadoop/
进入到安装目录后改名
mv elasticsearch-5.5.0/ elasticsearch
设置环境变量
vim /etc/profile
export SPARK_HOME=/usr/local/hadoop/elasticsearch
export PATH=PATH
source /etc/profile 让环境变量生效
添加一个普通用户,默认情况下 elasticsearch 不允许root直接运行(root运行ES会报错)
useradd elasticsearch
并创建数据和日志目录
mkdir -pv /data1/es5/{data,logs}
更改不同目录权限
chmod -R 777 /data1/es5/
chown -R elasticsearch.elasticsearch /usr/local/hadoop/elasticsearch
3、修改配置文件
修改es配置文件
vim elasticsearch.yml
cluster.name: elasticsearch
node.name: master
path.data: /data1/es5/data
path.logs: /data1/es5/logs
network.host: master
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: “*”
discovery.zen.ping.unicast.hosts: [“10.11.16.190”]
discovery.zen.minimum_master_nodes: 1
修改系统参数(如果做集群:ES集群节点都要操作)
vim /etc/security/limits.conf
添加内容
elasticsearch soft nproc 32000
elasticsearch hard nproc 32000
elasticsearch soft nofile 65536
elasticsearch hard nofile 65536
vim /etc/sysctl.conf
添加内容
fs.file-max=65536
vm.max_map_count=262144
sysctl -p 让配置生效
4、启动ES服务
先切换至普通用户
su - elasticsearch
elasticsearch -d 启动ES服务 (-d选项是 后台运行)
Web页面展现如下图http://IP地址:9200/说明已安装成功
开发人员使用需要下载一个web的elasticsearch插件协助使用。