linux安装Eslasticsearch以及elasticsearch-head,以及安装过程中的各种提示错误

注:安装ES之前,必须先安装jdk  yum -y list java*

1.   cd    /usr/local

     下载安装包   https://www.elastic.co/cn/products/elasticsearch   下载对应的版本

2. 解压安装包  tar -zxvf  elasticsearch-7.3.2-linux-x86_64.tar.gz

3.目录重新命名  mv elasticsearch-7.3.2 elasticsearch

4.创建用户名   useradd  es   (安装ES不可使用root用户)

5.创建目录 mkdir   /usr/local/elasticsearch     /usr/local/elasticsearch/data      /usr/local/elasticsearch/logs  

6.为用户赋权限   chown -R es /usr/local/elasticsearch

7.更改配置文件   config/elasticsearch.yml 文件    

     bootstrap.system_call_filter: false
     #设置索引数据的存储路径
     path.data: /usr/local/elasticsearch/data
     #设置日志的存储路径
     path.logs: /usr/local/elasticsearch/logs
     #设置当前的ip地址,通过指定相同网段的其他节点会加入该集群中

     network.host: 0.0.0.0

     http.port: 9200

     cluster.initial_master_nodes: ["order-node"]

    

   vi /etc/security/limits.conf

    * soft nofile 65536

    * hard nofile 131072

 注:* 代表Linux所有用户名称(比如 hadoop)

 

vi /etc/sysctl.conf 

  添加下面配置:

    vm.max_map_count=655360

  最后记得执行:

    sysctl -p

8.切换用户  su  es     进入目录    cd  /usr/local/elasticsearch        开始安装   ./bin/elasticsearch

  注:安装成功之后不会退出,也不可退出。退出为关闭服务。安装成功之后访问http://localhost:9200即可

linux安装Eslasticsearch以及elasticsearch-head,以及安装过程中的各种提示错误

出现上图为安装成功

 

 

 

安装elasticsearch-head插件

1 在/usr/local/elasticsearch 下创建一个新目录   mikdir   ./head

 下载安装包    https://github.com/mobz/elasticsearch-head下载zip 解压

  进入文件夹  cd  ./elasticsearch-head    

  node install

  npm   install

  npm  run   start

  注:需提前安装npm以及node.js    版本必须大于6.0

安装成功后在页面访问  http://localhost:9100  即可

因为es是端口9200,而head插件是9100,,解决跨域问题:

elasticsearch下的 config/elasticsearch.yml 添加下面两行

http.cors.enabled: true

http.cors.allow-origin: "*"

 

安装es时遇到的一些提示错误

1:[***]failed to send join request to master
原因:你复制了某个节点的elasticsearch文件夹,但是这里面包含了该节点的data文件
解决:删除elasticsearch文件夹下data目录的内容

2:ERROR: bootstrap checks failed
memory locking requested for elasticsearch process but memory is not locked
原因:锁定内存失败
解决:vi /etc/security/limits.conf 添加下面两行
* soft memlock unlimited
* hard memlock unlimited
tips:* 代表的是linux内所有的用户

3:ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
原因:无法创建本地文件,用户最大可创建文件数不够
解决:vim /etc/security/limits.conf
*                hard    nofile          65536
*                soft    nofile          65536
*                soft    nproc           65536
*                hard    nproc           65536

4:max number of threads [1024] for user [es] is too low, increase to at least [2048]
原因:无法创建本地线程问题,用户最大可创建线程数太小
解决:vi /etc/security/limits.d/90-nproc.conf
* soft nproc 2048(这边原本是1024)

5:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因:最大虚拟内存太小
解决:vim /etc/sysctl.conf 添加下面这一行
vm.max_map_count=262144
并执行命令:sysctl -p

6:system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因:Centos6不支持SecComp
解决:vi elasticsearch.yml  切记在内存锁的下面加
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

7:uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
原因:elasticsearch不能使用root用户启动
解决:创建新用户(useradd elasticsearch)并 chown -R es:es elasticsearch [更改elasticsearch文件夹的用户以及所属组]

8:unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and 
原因:linux内核版本太低
解决:凉凉,换个新版本的linux系统吧。

9:Unsupported major.minor version 52.0
原因:java版本太低
解决:更换jdk版本,ElasticSearch5.0.0支持jdk1.8.0以上

10:org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: Property [elasticsearch.version] is missing for plugin [head]
        原因:elasticsearch新版本是不允许安装插件在文件目录plugins下面的
        解决:将plugins下面的插件目录放到其他目录即可