elasticsearch6.8.6安装配置

 参考文章:

elasticsearch安装配置_qianhuan_的博客-CSDN博客_elasticsearch安装配置

CentOS7.3安装elasticsearch6.8.6 - 简书

##1.1 下载安装elasticsearch6.8.6, 并放到/usr/local/src/目录后
cd /usr/local/src/
unzip elasticsearch-6.8.6.zip
vim /usr/local/src/elasticsearch-6.6.2/config/elasticsearch.yml

##1.2 修改jvm.options
vim /usr/local/src/elasticsearch-6.8.6/config/jvm.options
————————————————
22行:-Xms1g ———>-Xms512m
23行:-Xmx1g ———>-Xmx512m
————————————————

##1.2 修改elasticsearch.yml
vim /usr/local/src/elasticsearch-6.8.6/config/elasticsearch.yml
————————————————
17行:设置cluster.name: elasticsearch(自定义集群名称)
23行:设置node.name: master(自定义当前es的节点名称)
43行:设置
bootstrap.network.host: 0.0.0.0
bootstrap.memory_lock: false
44行:设置bootstrap.system_call_filter: false
56行: network.host: 0.0.0.0 (设置当前节点的IP)

60行: 设置端口号 http.port: 9200


xpack.ml.enabled: false
network.host: 0.0.0.0
http.port: 9200
#内存
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#允许跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
#集群和节点
cluster.name: elasticsearch-cluster
node.name: master
node.master: true
————————————————


##2.下载安装elasticsearch插件
/usr/local/src/elasticsearch-6.8.6/bin/elasticsearch-plugin install analysis-icu
/usr/local/src/elasticsearch-6.8.6/bin/elasticsearch-plugin list

##3.新建es账户
groupadd elasticsearch
useradd -g elasticsearch elasticsearch 
chown -R elasticsearch:elasticsearch /usr/local/src/elasticsearch-6.8.6/

##4.修改配置
vi /etc/security/limits.conf

##4.启动elasticsearch
su elasticsearch
#4.1直接启动
/usr/local/src/elasticsearch-6.8.6/bin/elasticsearch
#4.2后台启动
/usr/local/src/elasticsearch-6.8.6/bin/elasticsearch -d

启动报错信息1: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
root 用户:vi /etc/sysctl.conf 添加 vm.max_map_count=262144:保存退出之后,执行命令 sysctl -p

启动报错信息2:max number of threads is too low
root 用户:vi /etc/security/limits.conf  在文件最后添加
* soft nofile 65536

* hard nofile 65536

* soft nproc 4096

* hard nproc 4096

启动报错信息3: max number of threads [1024] for user [elasticsearch] is too low, increase to at least [4096]

 vi /etc/security/limits.d/90-nproc.conf  改为4096
修改完记得退出elasticsearch 用户再进




一、环境

java1.8+

二、下载elasticsearch-6.8.6.tar.gz

下载地址:

解压elasticsearch-6.8.6.tar.gz

tar -zxvf elasticsearch-6.8.6.tar.gz

三、创建用户

启动es必须创建用户,不能使用root启动

useradd esuser

分配权限

chown -R esuser elasticsearch-6.8.6(安装的es目录)

四、修改配置文件

1、vim elasticsearch-6.8.6/conf/jvm.options

22行:-Xms1g ———>-Xms512m

23行:-Xmx1g ———>-Xmx512m

2、vim elasticsearch-6.8.6/conf/elasticsearch.yml

17行:设置cluster.nam: elasticsearch(自定义集群名称)

23行:设置node.name: node-1(自定义当前es的节点名称)

43行:设置bootstrap.mnetwork.host: 192.168.1.43emory_lock: false

44行:设置bootstrap.system_call_filter: false
56行: network.host: 192.168.1.43 (设置当前节点的IP)

60行: 设置端口号 http.port: 9200

最后添加:

http.cors.enabled: true

 http.cors.allow-origin: "*"

3、此时启动汇报错:ERROR: [2] bootstrap checks failed

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决:编辑 /etc/security/limits.conf,追加以下内容;

*                soft    nofile     300000

*                hard    nofile          300000

*                soft    nproc          102400

*                soft    memlock        unlimited

*                hard    memlock        unlimited

编辑 /etc/sysctl.conf,追加以下内容:

vm.max_map_count=655360

保存,启动 在bin/elasticsearch -d 后台启动

五、验证是否启动成功并能够连接使用

在服务器端: curl http://192.168.1.43:9200

浏览器:http://192.168.1.43:9200

出现以下内容表示成功:

{

  "name" : "node-1",

  "cluster_name" : "elasticsearch",

  "cluster_uuid" : "wwniBniiSeSnl90g2KGaIQ",

  "version" : {

    "number" : "6.8.6",

    "build_flavor" : "default",

    "build_type" : "tar",

    "build_hash" : "3d9f765",

    "build_date" : "2019-12-13T17:11:52.013738Z",

    "build_snapshot" : false,

    "lucene_version" : "7.7.2",

    "minimum_wire_compatibility_version" : "5.6.0",

    "minimum_index_compatibility_version" : "5.0.0"

  },

  "tagline" : "You Know, for Search"

}

六、安装分词器

将下载好的分词器压缩包上传至elasticsearch-6.8.6/plugins目录下,解压重启es即可



作者:晓冬1210
链接:https://www.jianshu.com/p/eedc0ad09e05
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

你可能感兴趣的:(elasticsearch)