Elasticsearch6.4.2在Centos 7 for power上的安装与配置
- 安装java环境
[root@localhost ~]# yum -y install java
- 查看java版本
[root@localhost ~]# java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
- 下载 Elasticsearch6.4.2
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz
- 解压到/usr/local/
tar -zxvf elasticsearch-5.6.3.tar.gz -C /usr/local/
- 运行Elasticsearch
Elasticsearch 要求不能使用超级用户root运行,所以我们建立一个testuser账号
# 创建testuser账户adduser testuser# 修改密码passwd testuser
然后,给testuser用户elasticsearch目录的授权。
chown -R testuser /usr/local/elasticsearch-5.6.3/
切换至elasticsearch目录,并以testuser用户运行
cd /usr/local/elasticsearch-5.6.3/
su testuser
运行elasticsearch,如果想后台运行后面加 -d
[testuser@localhost elasticsearch-5.6.3]$ ./bin/elasticsearch
如果没有没有error,就运行成功啦
- 新开一个终端,用curl访问
[root@localhost ~]# curl 'http://localhost:9200/?pretty'
{
"name" : "oDFU6c3",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "v2mGsAuuTsqIzzm8CZcW5w",
"version" : {
"number" : "5.6.3",
"build_hash" : "1a2f265",
"build_date" : "2017-10-06T20:33:39.012Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
- 其他配置
elasticsearch指定ip地址
编辑es的配置文件
[testuser@localhost elasticsearch-5.6.3]$ vim ./config/elasticsearch.yml
找到network.host: 一行,去除#号,修改为:
network.host: [_local_, 192.168.1.182]
172.30.6.1为指定的ip地址,可以是多个。
这样就可以在浏览器里打开啦
http://172.30.6.1:9200/?pretty
- 可能遇到的问题
问题一
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
max_map_count 的值是指一个进程最多可用于的内存映射区(memory map areas),在调用malloc会用到,由mmap/mprotect生成。
解决办法:
切换到root用户修改配置/etc/sysctl.conf
su rootvim /etc/sysctl.conf
加入
vm.max_map_count=655360
然后使其生效
sysctl -p
问题二
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
文件描述符太低
解决办法:
切换到root用户修改/etc/security/limits.conf
su rootvim /etc/security/limits.conf
加入
* soft nofile 65536* hard nofile 131072* soft nproc 2048* hard nproc 4096
Bootstrap 和 xpack的问题,在elasticsearch.yml中,增加如下配置
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
xpack.ml.enabled: false