标签:runtime cse proc 安装 locate javah 需要 虚拟内存 解决
一、环境以及注意事项
jdk: (build 1.8.0_151-b12)
elasticsearch:6.6.1
centos 7
注意的问题:jdk 版本 版本不能过低必须是1.8
root 用户不能启动es ,必须新建一个用户
下载解压
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.1.zip unzip elasticsearch-6.6.1.zip
1.1 创建新用户
如果你用root启动,会出现“java.lang.RuntimeException: can not runelasticsearch as root”错误,具体如下所示:
需要创建新用户来运行es
adduser [用户名]
passwd [用户名]
新创建的用户并不能使用sudo命令,需要给他添加授权。
chmod -v u+w /etc/sudoers
vim /etc/sudoers
chmod -v u-w /etc/sudoers
改变文件夹及所有子文件(夹)所属用户和用户组
chown -R kebi:kebi elasticsearch-6.6.1
二、常见问题
错误:“JavaHotSpot(TM) 64-Bit Server VM warning: INFO: error=‘Cannotallocate memory‘ (errno=12)”表示内存不足,其配置文件为config目录下的jvm.options,默认为2g,可以修改为1g。
错误“max virtual memory areas vm.max_map_count [65530]is too low, increase to at least [262144]”,max_map_count文件包含限制一个进程可以拥有的VMA(虚拟内存区域)的数量,系统默认是65530,修改成655360。
#在/etc/sysctl.conf文件最后添加一行 vm.max_map_count=655360 #并执行命令 sysctl -p
错误“max file descriptors [65535] for elasticsearchprocess is too low, increase to at least [65536]”,maxfile descriptors为最大文件描述符,设置其大于65536即可。
修改完以后,要执行下 source /etc/profile
ulimit -Hn
ulimit -Sn
2.3.2 max number of threads [3818] for user [es] is too low, increase to at least [4096]
问题同上,最大线程个数太低。修改配置文件/etc/security/limits.conf,增加配置
* soft nproc 4096 * hard nproc 4096
查看命令
ulimit -Hu
ulimit -Su
然后退出用户再登录,否则无效
2.4 启动报错
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
修改config目录下的jvm.options里面的参数,某些软件包启动的时候默认启用 -XX:+AssumeMP导致
修改config目录下elasticsearch.yml文件
0.0.0.0
["0.0.0.0"]
修改config目录下elasticsearch.yml文件,在最后新增以下两个参数
http.cors.enabled: true http.cors.allow-origin: "*"
修改config目录下elasticsearch.yml文件,在最后新增以下参数
thread_pool.bulk.queue_size: 1000
三、启动
3.1 切换新用户
su kebi
3.2 后台运行
进入目录下
bin/elasticsearch -d
标签:runtime cse proc 安装 locate javah 需要 虚拟内存 解决
原文地址:https://www.cnblogs.com/lyon91/p/11220312.html