1. 程式人生 > >elasticsearch通過ip進行訪問配置

elasticsearch通過ip進行訪問配置

修改 elasticsearch.yml

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.33.134
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation. 

   18-12-17T15:57:48,371][INFO ][o.e.p.PluginsService     ] [6l9CHPE] loaded module [x-pack-ml]
    [2018-12-17T15:57:48,371][INFO ][o.e.p.PluginsService     ] [6l9CHPE] loaded module [x-pack-monitoring]
    [2018-12-17T15:57:48,371][INFO ][o.e.p.PluginsService     ] [6l9CHPE] loaded module [x-pack-rollup]
    [2018-12-17T15:57:48,372][INFO ][o.e.p.PluginsService     ] [6l9CHPE] loaded module [x-pack-security]
    [2018-12-17T15:57:48,372][INFO ][o.e.p.PluginsService     ] [6l9CHPE] loaded module [x-pack-sql]
    [2018-12-17T15:57:48,372][INFO ][o.e.p.PluginsService     ] [6l9CHPE] loaded module [x-pack-upgrade]
    [2018-12-17T15:57:48,372][INFO ][o.e.p.PluginsService     ] [6l9CHPE] loaded module [x-pack-watcher]
    [2018-12-17T15:57:48,373][INFO ][o.e.p.PluginsService     ] [6l9CHPE] no plugins loaded
    [2018-12-17T15:57:53,192][INFO ][o.e.x.s.a.s.FileRolesStore] [6l9CHPE] parsed [0] roles from file [/myapps/elasticsearch-6.5.3/config/roles.yml]
    [2018-12-17T15:57:53,898][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [6l9CHPE] [controller/4064] [
[email protected]
] controller (64 bit): Version 6.5.3 (Build f418a701d70c6e) Copyright (c) 2018 Elasticsearch BV [2018-12-17T15:57:54,444][DEBUG][o.e.a.ActionModule ] [6l9CHPE] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security [2018-12-17T15:57:54,707][INFO ][o.e.d.DiscoveryModule ] [6l9CHPE] using discovery type [zen] and host providers [settings] [2018-12-17T15:57:55,739][INFO ][o.e.n.Node ] [6l9CHPE] initialized [2018-12-17T15:57:55,740][INFO ][o.e.n.Node ] [6l9CHPE] starting ... [2018-12-17T15:57:55,935][INFO ][o.e.t.TransportService ] [6l9CHPE] publish_address {192.168.33.134:9300}, bound_addresses {[::]:9300} [2018-12-17T15:57:55,961][INFO ][o.e.b.BootstrapChecks ] [6l9CHPE] bound or publishing to a non-loopback address, enforcing bootstrap checks ERROR: [1] bootstrap checks failed [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] [2018-12-17T15:57:56,024][INFO ][o.e.n.Node ] [6l9CHPE] stopping ... [2018-12-17T15:57:56,088][INFO ][o.e.n.Node ] [6l9CHPE] stopped [2018-12-17T15:57:56,089][INFO ][o.e.n.Node ] [6l9CHPE] closing ... [2018-12-17T15:57:56,105][INFO ][o.e.n.Node ] [6l9CHPE] closed [2018-12-17T15:57:56,109][INFO ][o.e.x.m.j.p.NativeController] [6l9CHPE] Native controller process has stopped - no new native processes can be started
[email protected]
:/myapps/elasticsearch-6.5.3/bin$ ls

永久性修改
cd /etc
編輯sysctl.conf,增加如下內容

vim sysctl.conf
# elasticsearch config start
vm.max_map_count=262144
# elasticsearch config end

一次性修改:
sysctl -w vm.max_map_count=262144
檢查配置是否生效
sysctl -a | grep “vm.max_map_count”
顯示vm.max_map_count = 262144


  Copyright (c) 2018 Elasticsearch BV
    [2018-12-17T16:06:39,574][DEBUG][o.e.a.ActionModule       ] [6l9CHPE] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
    [2018-12-17T16:06:39,815][INFO ][o.e.d.DiscoveryModule    ] [6l9CHPE] using discovery type [zen] and host providers [settings]
    [2018-12-17T16:06:40,738][INFO ][o.e.n.Node               ] [6l9CHPE] initialized
    [2018-12-17T16:06:40,738][INFO ][o.e.n.Node               ] [6l9CHPE] starting ...
    [2018-12-17T16:06:40,918][INFO ][o.e.t.TransportService   ] [6l9CHPE] publish_address {192.168.33.134:9300}, bound_addresses {[::]:9300}
    [2018-12-17T16:06:40,944][INFO ][o.e.b.BootstrapChecks    ] [6l9CHPE] bound or publishing to a non-loopback address, enforcing bootstrap checks
    ERROR: [1] bootstrap checks failed
    [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
    [2018-12-17T16:06:40,990][INFO ][o.e.n.Node               ] [6l9CHPE] stopping ...
    [2018-12-17T16:06:41,073][INFO ][o.e.n.Node               ] [6l9CHPE] stopped
    [2018-12-17T16:06:41,073][INFO ][o.e.n.Node               ] [6l9CHPE] closing ...
    [2018-12-17T16:06:41,093][INFO ][o.e.n.Node               ] [6l9CHPE] closed
    [2018-12-17T16:06:41,097][INFO ][o.e.x.m.j.p.NativeController] [6l9CHPE] Native controller process has stopped - no new native processes can be started
    [email protected]:/myapps/elasticsearch-6.5.3/bin$ 

然後編輯limits.conf增加如下配置:

# elasticsearch config start
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
# elasticsearch config end

在這裡插入圖片描述