栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Centos7使用docker搭建elasticsearch

Centos7使用docker搭建elasticsearch

安装docker

cat >/etc/yum.repos.d/docker.repo< [docker-ce-edge]
name=Docker CE Edge - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/edge
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
EOF

yum安装

yum -y install docker-ce

查看docker版本

docker --version

启动docker

systemctl enable docker
systemctl start docker

安装docker-compose

sudo curl -L “https://github.com/docker/compose/releases/download/2.3.3/docker-compose- ( u n a m e − s ) − (uname -s)- (uname−s)−(uname -m)” -o /usr/local/bin/docker-compose

加速docker镜像

可登录阿里云
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
然后获得
https://******.mirror.aliyuncs.com
页面中也有设置加速的代码

启动容器

创建对应文件夹目录
把下面文件保存成docker-compose.yml文件
执行:
docker-compose up
(如果有报错自行百度)

version: '2.2'
services:
  es790:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.0
    container_name: es790
    environment:
      - node.name=es790
      - cluster.initial_master_nodes=es790
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./data:/usr/share/elasticsearch790/data
    ports:
      - 9202:9200
    networks:
      - elastic7
  kib01:
    image: docker.elastic.co/kibana/kibana:7.9.0
    container_name: kib01
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_URL: http://es790:9200
      ELASTICSEARCH_HOSTS: '["http://es790:9200"]'
    networks:
      - elastic7
networks:
  elastic7:
    driver: bridge

如果报错
Native controller process has stopped - no new native processes can be started
可以将
- cluster.initial_master_nodes=es790
注释掉
然后添加
- discovery.type=single-node

安装ik分词

切换到docker项目根目录

docker-compose exec es790 /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.9.0/elasticsearch-analysis-ik-7.9.0.zip

systemctl restart docker
验证

访问安装机器的
ip:9202 以及 5601是否正常访问

如果正常访问可以停止容器,然后使用
docker-compose up -d
挂在后台运行即可

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/775533.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号