【异常】Docker安装elasticsearch7, 浏览使用 9200 无法打开

【异常】Docker安装elasticsearch7, 浏览使用 9200 无法打开

查看 容器日志如下:

  1.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-security]" }
  2.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-sql]" }
  3.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-voting-only-node]" }
  4.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-watcher]" }
  5.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,237+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "no plugins loaded" }
  6.  
    {"type": "server", "timestamp": "2020-02-27T11:29:50,742+08:00", "level": "INFO", "component": "o.e.x.s.a.s.FileRolesStore", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]" }
  7.  
    {"type": "server", "timestamp": "2020-02-27T11:29:51,271+08:00", "level": "INFO", "component": "o.e.x.m.p.l.CppLogMessageHandler", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "[controller/104] [Main.cc@110] controller (64 bit): Version 7.4.2 (Build 473f61b8a5238b) Copyright (c) 2019 Elasticsearch BV" }
  8.  
    {"type": "server", "timestamp": "2020-02-27T11:29:51,845+08:00", "level": "DEBUG", "component": "o.e.a.ActionModule", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "Using REST wrapper from plugin org.elasticsearch.xpack.security.Security" }
  9.  
    {"type": "server", "timestamp": "2020-02-27T11:29:52,280+08:00", "level": "INFO", "component": "o.e.d.DiscoveryModule", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "using discovery type [zen] and seed hosts providers [settings]" }
  10.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,253+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "initialized" }
  11.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,254+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "starting ..." }
  12.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,429+08:00", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "publish_address {192.168.0.249:9300}, bound_addresses {0.0.0.0:9300}" }
  13.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,437+08:00", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }
  14.  
    ERROR: [2] bootstrap checks failed
  15.  
    [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  16.  
    [2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
  17.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,450+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "stopping ..." }
  18.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,513+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "stopped" }
  19.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,513+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "closing ..." }
  20.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,530+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "closed" }
  21.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,534+08:00", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "Native controller process has stopped - no new native processes can be started" }
  22.  
    OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

重点看 error:
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

意思是:宿主机的 最大虚拟内存设置过小。

配置如下:

  1.  
    ##打开 sysctl.conf 文件
  2.  
    [root@slave1 ~]# vim /etc/sysctl.conf
  3.  
     
  4.  
    fs.file-max = 1000000
  5.  
    net.ipv4.tcp_max_tw_buckets = 6000
  6.  
    net.ipv4.tcp_sack = 1
  7.  
    net.ipv4.tcp_window_scaling = 1
  8.  
    net.ipv4.tcp_rmem = 4096 87380 4194304
  9.  
    net.ipv4.tcp_wmem = 4096 16384 4194304
  10.  
    net.ipv4.tcp_max_syn_backlog = 16384
  11.  
    net.core.netdev_max_backlog = 32768
  12.  
    net.core.somaxconn = 32768
  13.  
    net.core.wmem_default = 8388608
  14.  
    net.core.rmem_default = 8388608
  15.  
    net.core.rmem_max = 16777216
  16.  
    net.core.wmem_max = 16777216
  17.  
    net.ipv4.tcp_timestamps = 1
  18.  
    net.ipv4.tcp_fin_timeout = 20
  19.  
    net.ipv4.tcp_synack_retries = 2
  20.  
    net.ipv4.tcp_syn_retries = 2
  21.  
    net.ipv4.tcp_syncookies = 1
  22.  
    net.ipv4.tcp_tw_reuse = 1
  23.  
    net.ipv4.tcp_mem = 94500000 915000000 927000000
  24.  
    net.ipv4.tcp_max_orphans = 3276800
  25.  
    net.ipv4.ip_local_port_range = 1024 65000
  26.  
    net.nf_conntrack_max = 6553500
  27.  
    net.netfilter.nf_conntrack_max = 6553500
  28.  
    net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
  29.  
    net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
  30.  
    net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
  31.  
    net.netfilter.nf_conntrack_tcp_timeout_established = 3600
  32.  
    net.ipv4.neigh.default.gc_stale_time = 120
  33.  
    net.ipv4.conf.default.rp_filter = 0
  34.  
    net.ipv4.conf.all.rp_filter = 0
  35.  
    net.ipv4.conf.all.arp_announce = 2
  36.  
    net.ipv4.conf.lo.arp_announce = 2
  37.  
    kernel.sysrq = 1
  38.  
    vm.overcommit_memory = 1
  39.  
    vm.swappiness = 10
  40.  
    ## 添加如下 配置
  41.  
    vm.max_map_count = 655360
  42.  
     
  43.  
    ##重新加载 配置
  44.  
    [root@slave1 ~]# sysctl -p

注:
vm.max_map_count = 655360

 

然后。重启容器。访问正常

 

转载于:https://blog.csdn.net/weixin_42697074/article/details/104534336

【异常】Docker安装elasticsearch7, 浏览使用 9200 无法打开

查看 容器日志如下:

  1.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-security]" }
  2.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-sql]" }
  3.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-voting-only-node]" }
  4.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,236+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "loaded module [x-pack-watcher]" }
  5.  
    {"type": "server", "timestamp": "2020-02-27T11:29:46,237+08:00", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "no plugins loaded" }
  6.  
    {"type": "server", "timestamp": "2020-02-27T11:29:50,742+08:00", "level": "INFO", "component": "o.e.x.s.a.s.FileRolesStore", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]" }
  7.  
    {"type": "server", "timestamp": "2020-02-27T11:29:51,271+08:00", "level": "INFO", "component": "o.e.x.m.p.l.CppLogMessageHandler", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "[controller/104] [Main.cc@110] controller (64 bit): Version 7.4.2 (Build 473f61b8a5238b) Copyright (c) 2019 Elasticsearch BV" }
  8.  
    {"type": "server", "timestamp": "2020-02-27T11:29:51,845+08:00", "level": "DEBUG", "component": "o.e.a.ActionModule", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "Using REST wrapper from plugin org.elasticsearch.xpack.security.Security" }
  9.  
    {"type": "server", "timestamp": "2020-02-27T11:29:52,280+08:00", "level": "INFO", "component": "o.e.d.DiscoveryModule", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "using discovery type [zen] and seed hosts providers [settings]" }
  10.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,253+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "initialized" }
  11.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,254+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "starting ..." }
  12.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,429+08:00", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "publish_address {192.168.0.249:9300}, bound_addresses {0.0.0.0:9300}" }
  13.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,437+08:00", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }
  14.  
    ERROR: [2] bootstrap checks failed
  15.  
    [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  16.  
    [2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
  17.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,450+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "stopping ..." }
  18.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,513+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "stopped" }
  19.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,513+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "closing ..." }
  20.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,530+08:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "closed" }
  21.  
    {"type": "server", "timestamp": "2020-02-27T11:29:53,534+08:00", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "docker-cluster", "node.name": "hadoop_elasticsearch", "message": "Native controller process has stopped - no new native processes can be started" }
  22.  
    OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

重点看 error:
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

意思是:宿主机的 最大虚拟内存设置过小。

配置如下:

  1.  
    ##打开 sysctl.conf 文件
  2.  
    [root@slave1 ~]# vim /etc/sysctl.conf
  3.  
     
  4.  
    fs.file-max = 1000000
  5.  
    net.ipv4.tcp_max_tw_buckets = 6000
  6.  
    net.ipv4.tcp_sack = 1
  7.  
    net.ipv4.tcp_window_scaling = 1
  8.  
    net.ipv4.tcp_rmem = 4096 87380 4194304
  9.  
    net.ipv4.tcp_wmem = 4096 16384 4194304
  10.  
    net.ipv4.tcp_max_syn_backlog = 16384
  11.  
    net.core.netdev_max_backlog = 32768
  12.  
    net.core.somaxconn = 32768
  13.  
    net.core.wmem_default = 8388608
  14.  
    net.core.rmem_default = 8388608
  15.  
    net.core.rmem_max = 16777216
  16.  
    net.core.wmem_max = 16777216
  17.  
    net.ipv4.tcp_timestamps = 1
  18.  
    net.ipv4.tcp_fin_timeout = 20
  19.  
    net.ipv4.tcp_synack_retries = 2
  20.  
    net.ipv4.tcp_syn_retries = 2
  21.  
    net.ipv4.tcp_syncookies = 1
  22.  
    net.ipv4.tcp_tw_reuse = 1
  23.  
    net.ipv4.tcp_mem = 94500000 915000000 927000000
  24.  
    net.ipv4.tcp_max_orphans = 3276800
  25.  
    net.ipv4.ip_local_port_range = 1024 65000
  26.  
    net.nf_conntrack_max = 6553500
  27.  
    net.netfilter.nf_conntrack_max = 6553500
  28.  
    net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
  29.  
    net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
  30.  
    net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
  31.  
    net.netfilter.nf_conntrack_tcp_timeout_established = 3600
  32.  
    net.ipv4.neigh.default.gc_stale_time = 120
  33.  
    net.ipv4.conf.default.rp_filter = 0
  34.  
    net.ipv4.conf.all.rp_filter = 0
  35.  
    net.ipv4.conf.all.arp_announce = 2
  36.  
    net.ipv4.conf.lo.arp_announce = 2
  37.  
    kernel.sysrq = 1
  38.  
    vm.overcommit_memory = 1
  39.  
    vm.swappiness = 10
  40.  
    ## 添加如下 配置
  41.  
    vm.max_map_count = 655360
  42.  
     
  43.  
    ##重新加载 配置
  44.  
    [root@slave1 ~]# sysctl -p

注:
vm.max_map_count = 655360

 

然后。重启容器。访问正常

posted @ 2020-08-25 19:18  xing柠檬  阅读(1792)  评论(0编辑  收藏  举报