Elasticsearch下载安装及使用 女爷i 2022-12-03 01:57 227阅读 0赞 ### 文章目录 ### * * 一、下载 * 二、安装 * 三、启动 * 四、远程访问 ## 一、下载 ## [https://www.elastic.co/cn/downloads/elasticsearchhttps://www.elastic.co/cn/downloads/elasticsearch][https_www.elastic.co_cn_downloads_elasticsearchhttps_www.elastic.co_cn_downloads_elasticsearch] ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center] ## 二、安装 ## elasticsearch-7.9.0-linux-x86\_64.tar.gz 上传到linux机器,我存放目录是:/home/ies/webserver 执行如下代码进行解压: cd /home/ies/webserver tar -zxvf elasticsearch-7.9.0-linux-x86_64.tar.gz ## 三、启动 ## 执行如下代码: /home/ies/webserver/elasticsearch-7.9.0/bin/elasticsearch 如果一切正常,Elasticsearch就会在默认的9200端口运行。这时,打开另一个命令行窗口,请求该端口: curl localhost:9200 出现如下截图,说明运行成功: ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center 1] ## 四、远程访问 ## 此时,如果你在浏览器中访问:http://192.168.22.2:9200/ 则不成功,说明默认情况下,Elasticsearch 只允许本机访问,如果需要远程访问,可以修改 Elasticsearch 安装目录中的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成0.0.0.0,让任何人都可以访问,然后重新启动Elasticsearch。 ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center 2] 在重启过程中,报了5个错误: ERROR: [5] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] [2]: max number of threads [1024] for user [ies] is too low, increase to at least [4096] [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] [4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk [5]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured 下面我们分别解决一下:`如下操作都以root用户进行` **第一、二个问题:** [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] 在文件 /etc/security/limits.conf 的最后添加如下两行: ies soft nofile 65536 ies hard nofile 65536 ies soft nproc 65536 ies hard nproc 65536 * 表示匹配所有用户, nofile表示用户可以打开文件的最大数目 * 表示匹配所有用户, nofile表示配置最大打开线程数 `修改之后,需要重新登录终端才能生效` **第三个问题:** max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 在文件 /etc/sysctl.conf 的最后添加如下一行: vm.max_map_count=655360 保存立即生效: sysctl -p 查看是否生效: sysctl -a|grep vm.max_map_count ![在这里插入图片描述][20200901145211870.png_pic_center] **第4个问题:** [4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk 原因: 这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system\_call\_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。 解决: 在elasticsearch.yml中配置bootstrap.system\_call\_filter为false,注意要在Memory下面: bootstrap.memory\_lock: false bootstrap.system\_call\_filter: false **第5个问题:** the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured 解释: 在config/elasticsearch.yml中配置以下三者,最少其一 修改: # 我这里修改的是:node1是节点的node-name的值:BSHMS02 cluster.initial_master_nodes: ["BSHMS02"] 重新启动: /home/ies/webserver/elasticsearch-7.9.0/bin/elasticsearch 此时通过浏览器访问:http://192.168.22.2:9200/ ,出现如下截图,说明设置成功了! ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center 3] [https_www.elastic.co_cn_downloads_elasticsearchhttps_www.elastic.co_cn_downloads_elasticsearch]: https://www.elastic.co/cn/downloads/elasticsearch [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center]: /images/20221123/f08c15992f6d46b897c16a43a2e1dbd7.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center 1]: /images/20221123/3ebf9a4cea34446e9dd8a5c6c87312c1.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center 2]: /images/20221123/c668113a50b54c8380141f06af8c4595.png [20200901145211870.png_pic_center]: /images/20221123/bdc43288129e4aa6a90da3f6234cfb2b.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2hvdXBlaWJpbjIwMTI_size_16_color_FFFFFF_t_70_pic_center 3]: /images/20221123/a90ff7fa9930481fb837432d0efd2854.png
还没有评论,来说两句吧...