纵有疾风起
人生不言弃

CentOS7下安装Elasticsearch-7.3.2和Elasticsearch-head

下载Elasticsearch-7.3.2-linux-x86_64.tar.gz
Elasticsearch下载地址:
https://www.elastic.co/cn/downloads/elasticsearch
Elasticsearch-head+node+grunt下载地址:
https://download.csdn.net/download/zhengzaifeidelushang/11851790
在这里插入图片描述

#解压缩tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz#实现远程访问需要对config/elasticsearch.yml进行配置network.host: 10.177.33.47   #本地IP地址http.port: 9200#配置elasticsearch允许跨域访问#打开elasticsearch的配置文件elasticsearch.yml,在文件末尾追加下面http.cors.enabled: true http.cors.allow-origin: "*"node.master: truenode.data: true#启动elasticsearchcd /opt/elasticsearch/bin./elasticsearch#出现如下错误Caused by: java.lang.RuntimeException: can not run elasticsearch as root

Elasticsearch可以接收用户输入的脚本并且执行,root下执行Elasticsearch会报错,为了系统安全考虑,创建一个单独的用户来运行Elasticsearch

解决方法如下:

#创建elsearch用户组及elsearch用户:groupadd elsearchuseradd elsearch -g elsearch -p  es@123#更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearchchown -R elsearch:elsearch  elasticsearch#切换到elsearch用户再启动su elsearch cd /opt/elasticsearch/bin./elasticsearch#查看es状态curl 10.177.33.47:9200#或者通过浏览器查看firefoxlocalhost:9200#出现如下错误按照处理方法更改配置文件ERROR: [2] bootstrap checks failed[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144][2]: 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[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]#处理第一个错误方法:#配置内存vim /etc/sysctl.confvm.max_map_count=655360#保存后执行命令生效:sysctl -p#重新启动后成功[2]: 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文件vim elasticsearch.ymlcluster.initial_master_nodes: ["node-1"]#如还出现下面报错,按照处理方法解决[3]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]#处理第三个错误方法:vim /etc/security/limits.conf#修改文件最大打开数elsearch soft nofile 65536elsearch hard nofile 65536elsearch soft nproc 4096elsearch hard nproc 4096[4] max num of threads [3790] for user [elsticsearch] is too low, increase to at least [4096] #处理第四个错误方法:vim /etc/security/limits.d/20-nproc.confelsearch   soft   nproc   4096  #重新启动 ./elasticsearch#windows客户端网页输入ip和端口即可登陆linux上的Elasticsearch 10.177.33.47:9200#需要可关闭防火墙:systemctl stop firewalld.service

安装elasticsearch-head

# 1. 解压 unzip elasticsearch-head-master.zip# 2.下载nodejs  tar -xvf node-v12.11.1-linux-x64.tar.xz#设置node环境变量#node,NODE_HOME是node绝对安装路径vim /etc/profileexport NODE_HOME=/moudle/nodeexport PATH=$PATH:$NODE_HOME/bin#查看node版本号node -v #3.安装grunt#grunt离线安装包grunt.tar,可以安装在任意位置tar -zxvf grunt.tar #添加grunt-cli环境变量vim ~/.bash_profile# User specific environment and startup programsPATH=$PATH:$HOME/bin:/moudle/node/bin:/moudle/grunt/binexport PATH#查看版本号grunt-cli v1.3.2grunt v1.0.4#修改Gruntfile.js 允许所有IP都可以访问connect: {            server: {                  options: {                          hostname:'*',                          port: 9100,                          base: '.',                          keepalive: true                            }                     }         }#防火墙开启9100端口#firewall-cmd --zone=public --add-port=9100/tcp --permanent#重启防火墙#firewall-cmd --reload#启动elasticsearch,进入elasticsearch-head安装目录grunt server#运行成功显示Running "connect:server" (connect) taskWaiting forever...Started connect web server on http://localhost:9100#在浏览器中输入10.177.33.47:9100打开elasticsearch-headElasticsearch连接地址为:http://10.177.33.47:9200/

在这里插入图片描述

文章转载于:https://www.cnblogs.com/lm970585581/p/13442781.html

原著是一个有趣的人,若有侵权,请通知删除

未经允许不得转载:起风网 » CentOS7下安装Elasticsearch-7.3.2和Elasticsearch-head
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录