概述
max virtual memory areas vm.maxmapcount [65530] is too low
$ sudo sysctl -w vm.max_map_count=262144
curl: (6) Could not resolve host: XGET; Name or service not known
[shaoteng@iz2ze9d7x8qidhuch2m2mjz ~]$ curl XGET "localhost:9200/?pretty"
curl: (6) Could not resolve host: XGET; Name or service not known
{
"name" : "Lady Lark",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.4.0",
"build_hash" : "ce9f0c7394dee074091dd1bc4e9469251181fc55",
"build_timestamp" : "2016-08-29T09:14:17Z",
"build_snapshot" : false,
"lucene_version" : "5.5.2"
},
"tagline" : "You Know, for Search"
}
错误原因 -XGET 少些了符号 '-'
可能遇到的错误-max virtual memory
如果这时报错"max virtual memory areas vm.maxmapcount [65530] is too low",要运行下面的命令。
$ sudo sysctl -w vm.max_map_count=262144
可能遇到的错误-can not run elasticsearch as root
这是出于系统安全考虑设置的条件。由于ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑,
建议创建一个单独的用户用来运行ElasticSearch
我们需要添加用户。
adduser es
//添加用户es
passwd es
//给用户es密码赋值
添加完用户之后:
用root用户执行 :
chown -R 用户名 文件夹名
chown -R es /data/elasticsearch-6.4.3
将这几个压缩包所在的文件夹及解压完的文件夹权限给你新建的用户。之后再使用新用户启动就OK了。
su es
./bin/elasticsearch
可能遇到问题-max file descriptors
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
切换到root用户
su root
ulimit -Hn
//查看硬限制
解决方法
vim /etc/security/limits.conf
添加下面设置 es是启动elasticsearch的用户
es soft nofile 65536
es hard nofile 65536
退出用户重新登录,使配置生效
su es
重新
ulimit -Hn
查看硬限制 会发现数值有4096改成65535
如果启动一切正常,Elastic 就会在默认的9200端口运行。这时,打开另一个命令行窗口,请求该端口,会得到说明信息。
$ curl localhost:9200
{
"name" : "00p5sY4",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "2MjaUbyiQrW1D9PRCCEg-Q",
"version" : {
"number" : "6.4.3",
"build_flavor" : "default",
"build_type" : "zip",
"build_hash" : "fe40335",
"build_date" : "2018-10-30T23:17:19.084789Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
启动就被killed
[shaoteng@iz2ze9d7x8qidhuch2m2mjz bin]$ ./elasticsearch
[2019-02-15T10:31:59,264][INFO ][o.e.e.NodeEnvironment
] [KM5h-3P] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [30.8gb], net total_space [39.2gb], types [rootfs]
[2019-02-15T10:31:59,285][INFO ][o.e.e.NodeEnvironment
] [KM5h-3P] heap size [1015.6mb], compressed ordinary object pointers [true]
[2019-02-15T10:31:59,286][INFO ][o.e.n.Node
] [KM5h-3P] node name derived from node ID [KM5h-3PaRHOB-Ht0JryB0A]; set [node.name] to override
[2019-02-15T10:31:59,287][INFO ][o.e.n.Node
] [KM5h-3P] version[6.6.0], pid[9667], build[default/tar/a9861f4/2019-01-24T11:27:09.439740Z], OS[Linux/3.10.0-693.2.2.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_191/25.191-b12]
[2019-02-15T10:31:59,287][INFO ][o.e.n.Node
] [KM5h-3P] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-3621266625781894929, -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, -Des.path.home=/usr/elastic/elasticsearch-6.6.0, -Des.path.conf=/usr/elastic/elasticsearch-6.6.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-02-15T10:32:12,463][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [aggs-matrix-stats]
[2019-02-15T10:32:12,465][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [analysis-common]
[2019-02-15T10:32:12,465][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [ingest-common]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [lang-expression]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [lang-mustache]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [lang-painless]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [mapper-extras]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [parent-join]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [percolator]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [rank-eval]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [reindex]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [repository-url]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [transport-netty4]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [tribe]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-ccr]
[2019-02-15T10:32:12,466][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-core]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-deprecation]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-graph]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-ilm]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-logstash]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-ml]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-monitoring]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-rollup]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-security]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-sql]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-upgrade]
[2019-02-15T10:32:12,467][INFO ][o.e.p.PluginsService
] [KM5h-3P] loaded module [x-pack-watcher]
[2019-02-15T10:32:12,468][INFO ][o.e.p.PluginsService
] [KM5h-3P] no plugins loaded
Killed
原因是内存不足造成的,修改elastic/config下的jvm.options
设置值不能查过物理内存的50%,不能设置生小数,比如0.5g是不允许的
-Xms512M
-Xmx512M
bootstrap checks failed
修改elasticsearch.yml配置文件,允许外网访问。
vim config/elasticsearch.yml
增加
network.host: 0.0.0.0
启动失败,检查没有通过,报错
2018-05-18T17:44:59,658][INFO ][o.e.b.BootstrapChecks ] [gFOuNlS] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
编辑 /etc/security/limits.conf,追加以下内容;
* soft nofile 65536
* hard nofile 65536
此文件修改后需要重新登录用户,才会生效
[2]: 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
重新启动,成功。
bin/elasticsearch &
无法访问此网站
如果elasticsearch.yml配置完之后,一直外网无法访问,请联系服务器管理员9200端口是否开放
假设已经开放了8000-9000的端口号,9200并没有开放
修改elasticsearch.yml,
httpd.part: 8900
重启elastic,
/bin/elacticsearch
重新请求,(这里使用的是curl请求,使用外网浏览器也是可以的)
[root@ ]# curl -XGET 127.0.0.1:8900
{
"name" : "KM5h-3P",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "36YC-EVQS9uIrWgBaisAhw",
"version" : {
"number" : "6.6.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "a9861f4",
"build_date" : "2019-01-24T11:27:09.439740Z",
"build_snapshot" : false,
"lucene_version" : "7.6.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
最后
以上就是要减肥小天鹅为你收集整理的elasticsearch问题总结增加的全部内容,希望文章能够帮你解决elasticsearch问题总结增加所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复