centos安装ElasticSearch
获取ES
下载ES,拷贝至目录 /opt
安装es
解压
1 | tar -zxvf es.tar.gz |
创建用户用户组,修改文件权限
由于ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑,需要创建一个单独的用户用来运行ElasticSearch
1 | groupadd elastic |
启动es
切换到es目录,启动
1 | cd /opt/elasticsearch-7.13.4/bin |
检查
本地检查
1 | curl 127.0.0.1:9200 |
外网检查
浏览器访问 {ip}:9200
可能出现的问题
启动可能遇到的问题
未使用ES_JAVA_HOME 变量
JAVA_HOME 不行的
1 | warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME |
解决方案:环境变量中加入ES_JAVA_HOME
1 | vim /etc/profile |
内存不对
1 | JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,JRE, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.io.tmpdir=/tmp/elasticsearch-3461752725857884135, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Xms1024m, -Xmx1024m, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/opt/elasticsearch-7.13.4, -Des.path.conf=/opt/elasticsearch-7.13.4/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true |
解决方案: 修改Java虚拟机内存
1 | vim config/jvm.options |
外网无法访问
修改配置文件 config/elasticsearch.yml 中的 network.host 重启
1 | vim config/elasticsearch.yml |
启动报内存不足
1 | bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. |
解决:
内存太小了,需要修改vm.max_map_count的内存大小
切换到root账户 命令 su root 修改sysctl.conf文件
1 | su root |
启动报hosts
1 | bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. |
解决
1 | vim config/elasticsearch.yml |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 KewenBlogs!
评论