- 下载地址
https://www.elastic.co/products/elasticsearch
- 上传elasticsearch-6.3.2.tar.gz移动到 /usr/local/upload 下
- 解压,移到/usr/local/
tar -zxvf elasticsearch-6.1.1.tar.gz
mv elasticsearch-6.1.1 /usr/local/upload
在/usr/local/elasticsearch-6.3.2/ 新建目录data
- 从5.0开始,ElasticSearch 安全级别提高了,不允许采用root帐号启动,所以我们要添加一个用户。
- 创建bigdata 用户组
groupadd bigdata
- 创建用户es
useradd es
passwd es
- 将es用户添加到bigdata组
usermod -G bigdata es
- 设置sudo权限
visudo
找到root ALL=(ALL) ALL一行,添加es用户,如下。
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
es ALL=(ALL) ALL
- 切换用户
[root@node1 ~]# su es
[es@node1 root]$ cd
[es@node1 ~]$
- 修改目录权限, 更改elasticsearch-6.3.2文件夹以及内部文件的所属用户为es, 用户组组为bigdata,-R表示逐级(N层目录)
[es@iZbp1hb9k9jtcple1ncwjzZ /]$ sudo chown -R es:bigdata /opt/elasticsearch-6.3.2
[es@iZbp1hb9k9jtcple1ncwjzZ /]$ ll /usr/local/elasticsearch-6.3.2/
total 464
drwxr-xr-x 3 es bigdata 4096 Aug 2 14:59 bin
drwxr-xr-x 2 es bigdata 4096 Aug 2 15:11 config
drwxr-xr-x 2 es bigdata 4096 Aug 2 15:17 data
drwxr-xr-x 2 es bigdata 4096 Jul 20 13:26 lib
-rw-r--r-- 1 es bigdata 13675 Jul 20 13:15 LICENSE.txt
drwxr-xr-x 2 es bigdata 4096 Jul 20 13:26 logs
drwxr-xr-x 17 es bigdata 4096 Jul 20 13:26 modules
-rw-r--r-- 1 es bigdata 416018 Jul 20 13:26 NOTICE.txt
drwxr-xr-x 2 es bigdata 4096 Jul 20 13:26 plugins
-rw-r--r-- 1 es bigdata 8511 Jul 20 13:15 README.textile
[es@iZbp1hb9k9jtcple1ncwjzZ /]$
- ElasticSearch 配置
- 修改elasticsearch.yml
cluster.name: wdz-es
path.data: /usr/local/elasticsearch-6.3.2/data
path.logs: /usr/local/elasticsearch-6.3.2/logs
bootstrap.system_call_filter: false
network.host: 0.0.0.0
http.port: 9200
- 修改/etc/sysctl.conf
切换到root用户
vi /etc/sysctl.conf
添加下面的配置
vm.max_map_count=655360
命令生效
[es@iZbp1hb9k9jtcple1ncwjzZ /]# sysctl -p
- 修改文件/etc/security/limits.conf
根据服务器配置来设置(最下面)
# End of file
* soft nproc 1000000
* hard nproc 1000000
* soft nofile 1000000
* hard nofile 1000000
重新登录 生效
- 修改 vi /etc/security/limits.d/90-nproc.conf_bk
#* soft nproc 1024
root soft nproc unlimited
- 启动es
- 切换到es用户,进入es目录下
bin/elasticsearch
如果不报错Ctrl+C 退出,可以通过参数-d后台运行
bin/elasticsearch -d
- 进程查询
[es@iZbp1hb9k9jtcple1ncwjzZ elasticsearch-6.3.2]$ jps
6891 Jps
5117 Elasticsearch
- 验证
[es@iZbp1hb9k9jtcple1ncwjzZ elasticsearch-6.3.2]$ curl localhost:9200
{
"name" : "kczazM0",
"cluster_name" : "wdz-es",
"cluster_uuid" : "SrQcvSF1SE6pj4BIGlccww",
"version" : {
"number" : "6.3.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "053779d",
"build_date" : "2018-07-20T05:20:23.451332Z",
"build_snapshot" : false,
"lucene_version" : "7.3.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
- 如果ps -aux|grep elasticsearch看不到Java进程
chown -R es:es /tmp/hsperfdata_es