docker安装elastic的错误

首先我的配置是:

version: "3.1"
services:
  elasticsearch:
    image: daocloud.io/library/elasticsearch:7.6.2
    restart: always
    container_name: elasticsearch
    ports:
      - 9200:9200
   
  kibana:
    image: daocloud.io/library/kibana:7.6.2
    restart: always
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      - elasticsearch_url=http://10.9.63.158:9200
    depends_on:
      - elasticsearch

docker安装elastic的错误

报上面的错,说什么内存不够,于是虚拟机加内存到4G,同时,加上下面的操作.

操作:

vi /etc/sysctl.conf
# 追加
vm.max_map_count=655360
#保存退出
# 执行命令
sysctl -p

重启elastcisearch,有报错!!!!!!!。

发现网上给他添加了一个环境变量,所以给他加一个环境变量.最后如下.

elasticsearch    | ERROR: [1] bootstrap checks failed
elasticsearch    | [1]: 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
elasticsearch    | ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log
version: "3.1"
services:
  elasticsearch:
    image: daocloud.io/library/elasticsearch:7.6.2
    restart: always
    container_name: elasticsearch
    ports:
      - 9200:9200
    environment:
      discovery.type: single-node
  kibana:
    image: daocloud.io/library/kibana:7.6.2
    restart: always
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      - elasticsearch_url=http://10.9.63.158:9200
    depends_on:
      - elasticsearch

添加分词器,在github上下载好.解压后改名为ik文件夹名,放到linux当前目录下的plugins下面
然后修改docker-compose.yml文件添加数据卷.

version: "3.1"
services:
  elasticsearch:
    image: daocloud.io/library/elasticsearch:7.6.2
    restart: always
    container_name: elasticsearch
    ports:
      - 9200:9200
    environment:
      discovery.type: single-node
    volumes:
      - ./plugins/:/usr/share/elasticsearch/plugins
  kibana:
    image: daocloud.io/library/kibana:7.6.2
    restart: always
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      - elasticsearch_url=http://10.9.63.158:9200
    depends_on:
      - elasticsearch

重启elasticsearch,看日志

报错,一个老外说不能放到plugs文件夹下面,所以只能启动容器后移进去,在重启

于是把数据卷删了,进去容器创建一个文件夹放进去。


[root@localhost elasticSearch]# docker ps
CONTAINER ID        IMAGE                                     COMMAND                  CREATED             STATUS              PORTS                              NAMES
cf0c4b6d7999        daocloud.io/library/kibana:7.6.2          "/usr/local/bin/dumb…"   5 minutes ago       Up 5 minutes        0.0.0.0:5601->5601/tcp             kibana
80854bc1a023        daocloud.io/library/elasticsearch:7.6.2   "/usr/local/bin/dock…"   5 minutes ago       Up 5 minutes        0.0.0.0:9200->9200/tcp, 9300/tcp   elasticsearch
[root@localhost elasticSearch]# docker exec -it 80 bash
[root@80854bc1a023 elasticsearch]# ls
LICENSE.txt  README.asciidoc  config  jdk  logs     plugins
NOTICE.txt   bin              data    lib  modules
[root@80854bc1a023 elasticsearch]# mkdir ik
[root@80854bc1a023 elasticsearch]# ls
LICENSE.txt  README.asciidoc  config  ik   lib   modules
NOTICE.txt   bin              data    jdk  logs  plugins
[root@80854bc1a023 elasticsearch]# cd ik
[root@80854bc1a023 ik]# pwd
/usr/share/elasticsearch/ik
[root@80854bc1a023 ik]# exit
exit
[root@localhost elasticSearch]# docker cp ./plugins/ik/ 80854bc1a023:/usr/share/elasticsearch/ik

上一篇:一致性哈希


下一篇:数据库索引详解