3 centos 下安装 elastic search 启动的问题
来源:互联网 发布:最新网络神曲排行榜 编辑:程序博客网 时间:2024/06/05 10:07
正常步骤
1Download and unzip Elasticsearch
2 Run bin/elasticsearch3 Run curl http://localhost:9200/
异常信息:
root 账户启动报错,Exception in thread "main" Java.lang.RuntimeException: don't run elasticsearch as root.
解决办法:
解决方法1:
在执行elasticSearch时加上参数-Des.insecure.allow.root=true,完整命令如下
解决办法2:用vi打开elasicsearch执行文件,在变量ES_JAVA_OPTS使用前添加以下命令
解决办法3:
添加新用户组和用户,让非root 用户组用户启动:
groupadd elsearch
useradd es -g elsearch -p 123456
然后把我们的es 所在文件夹的 用户指定为 elsearch
chown -R elsearch:elsearch elasticsearch
启动成功之后 会有日志:
[2016-12-20T18:40:28,270][INFO ][o.e.g.GatewayService ] [MUQhN6Y] recovered [0] indices into cluster_state
[2016-12-20T18:40:28,276][INFO ][o.e.h.HttpServer ] [MUQhN6Y] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2016-12-20T18:40:28,276][INFO ][o.e.n.Node ] [MUQhN6Y] started
访问url 成功会有结果:
{
"name" : "MUQhN6Y",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "GQd_A6XCRFKMnzswmckmuA",
"version" : {
"number" : "5.1.1",
"build_hash" : "5395e21",
"build_date" : "2016-12-06T12:36:15.409Z",
"build_snapshot" : false,
"lucene_version" : "6.3.0"
},
"tagline" : "You Know, for Search"
}
现在本机访问可以访问了,但是在其他机器上访问还是有问题,提示连接拒绝,为什么呢?
因为这个端口只是监听127.0.0.1 的回环地址,不监听其他地址,而127 的地址只能本机访问,所以其他机器无法访问这台机器。
那该怎么办呢?
es 提供了解决办法:
/usr/local/share/elasticsearch-5.1.1/config 目录下有一个 文件elasticsearch.yml
如果想监听本机所有ip ,则配置:network.host: 0.0.0.0
如果想监听指定ip,多个ip逗号隔开 则:network.host: 127.0.0.1,192.168.12.18
然后重新启动,爆出异常:
1 max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
2 vm.max_map_count [65530] likely too low, increase to at least [262144]
第一个问题:解决方案:
同样回到config/elasticsearch.yml文件,找到如下配置,开放discovery.zen.ping.unicast.hosts及discovery.zen.minimum_master_nodes
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
然后修改max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]这个错误(切换到root操作)
切换到root 用户 :
[root@localhost ~]# cp /etc/security/limits.conf /etc/security/limits.conf.bak
[root@localhost ~]# cat /etc/security/limits.conf | grep -v "seven" > /tmp/system_limits.conf
[root@localhost ~]# echo "seven hard nofile 65536" >> /tmp/system_limits.conf
[root@localhost ~]# echo "seven soft nofile 65536" >> /tmp/system_limits.conf
[root@localhost ~]# mv /tmp/system_limits.conf /etc/security/limits.conf
以上serven 名称为 自己的非root 用户名。
修改后重新登录seven用户,使用如下命令查看是否修改成功
第2个问题:解决方案:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
上面还有一个错误是关于jvm内存分配的问题heap size [268435456] not equal to maximum heap size [2147483648],需要修改的jvm配置
- 1
将-Xmx2g改成-Xmx256m,也就是heap size [268435456] /1024/1024的值
又爆出第三个问题:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解决方案:
# vi /etc/security/limits.d/90-nproc.conf # Default limit for number of user‘s processes to prevent# accidental fork bombs.# See rhbz #432903 for reasoning.* soft nproc 1024root soft nproc unlimited
修改1024 为2048 。
最后终于启动成功,并且其他机器也可以访问了。
- 3 centos 下安装 elastic search 启动的问题
- Elastic search的日期问题
- elastic search下载与启动
- Elastic Search安装及使用
- centos下oracle11g的安装与启动
- MongoDB centos下的安装和启动
- centos7 安装 elastic search 2.3.2
- elastic search
- elastic search 中读取数据问题
- Elastic search问题笔记: scroll查询数据
- VMware下安装Centos内存不足无法启动Kdump问题
- Apache solr和elastic search的比较
- solr与elastic search的比较
- centos下nfs安装遇到的问题
- centos下安装xcrysden出现的问题
- CentOS下安装wireshark遇到的问题
- Elastic Search快速上手(3):搜索
- CentOS下mysql.tar.gz的安装及启动
- Andriod 第八课----传感器
- 故事会-设计模式-工厂方法
- 为RecyclerView打造简单易用扩展性高的万能适配器
- HTML让文字在图片上显示
- 工具类
- 3 centos 下安装 elastic search 启动的问题
- pycaffe学习之(三):caffenet.py
- Ctags 的安装与使用(使用命令详解)
- ios 打包上线
- Android向服务器发送心跳服务
- VIM中正则的非贪婪匹配
- Android Studio引用mipmap中引用.9图片报错
- Cookie和Session的作用和工作原理
- (三)输出函数