Hanlp分词插件docker集群安装

背景:我是用docker-compose的方式装的es集群,正常情况es镜像没有插件,如果在docker里面用命令安装了那么重启以后又没了,所以采用挂载离线安装的方式
版本: es7.2
  • 2 创建二个目录 plugins : 映射es镜像里面的插件位置  config:映射配置位置,docker-compose.yaml是我的docker-compse配置文件
  • 3  在plugin下新建一个文件夹analysis-hanlp,把上面下载的zip文件解压到新建的文件夹
  • 4 通过docker cp es容器id:/usr/share/elasticsearch/config/jvm.options  ./   拷贝出来 放到前面config文件夹下面  (这里我是先启动了一个es容器,才能执行这个命令)
  • 5 在config下面新建一个文件夹analysis-hanlp 把之前解压plugins文件夹下面的/plugins/analysis-hanlp/config/下所有文件拷贝过来
  • 6 配置我的docker-compose.yaml文件
    • 我还是我的docker-compose.yaml内容贴出来吧:
  
version: '2.2'
services:
  cerebro:
    image: lmenezes/cerebro:0.8.3
    container_name: cerebro
    ports:
      - "9000:9000"
    command:
      - -Dhosts.0.host=http://elasticsearch:9200
    networks:
      - es7net
  kibana:
    image: kibana:7.2.0
    container_name: kibana7
version: '2.2'
services:
  cerebro:
    image: lmenezes/cerebro:0.8.3
    container_name: cerebro
    ports:
      - "9000:9000"
    command:
      - -Dhosts.0.host=http://elasticsearch:9200
    networks:
      - es7net
  kibana:
    image: kibana:7.2.0
    container_name: kibana7
    environment:
      - I18N_LOCALE=zh-CN
      - XPACK_GRAPH_ENABLED=true
      - TIMELION_ENABLED=true
      - XPACK_MONITORING_COLLECTION_ENABLED="true"
    ports:
      - "5601:5601"
    networks:
      - es7net
  elasticsearch:
    image: elasticsearch:7.2.0
    container_name: es01
    environment:
      - node.name=es01
      - discovery.seed_hosts=es02
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata01:/usr/share/elasticsearch/data
      - ./plugins:/usr/share/elasticsearch/plugins
      - ./config/jvm.options:/usr/share/elasticsearch/config/jvm.options
      - ./config/analysis-hanlp:/usr/share/elasticsearch/config/analysis-hanlp
    ports:
      - 9200:9200
    networks:
      - es7net
  elasticsearch2:
    image: elasticsearch:7.2.0
    container_name: es02
    environment:
      - node.name=es02
      - discovery.seed_hosts=es01
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata02:/usr/share/elasticsearch/data
      - ./plugins:/usr/share/elasticsearch/plugins
      - ./config/jvm.options:/usr/share/elasticsearch/config/jvm.options
      - ./config/analysis-hanlp:/usr/share/elasticsearch/config/analysis-hanlp
    networks:
      - es7net








volumes:
  esdata01:
    driver: local
  esdata02:
    driver: local




networks:
  es7net:
    driver: bridge

 

  • 7 重启 docker-compose restart
  • 8 测试(用的kibana)(分词成功)
    

转载于:https://www.cnblogs.com/spicy/p/11542529.html

评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符 “速评一下”
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页