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

Centos7安装Docker+elasticsearch(离线安装)

Centos7安装Docker+elasticsearch(离线安装)

docker下载地址:https://download.docker.com/linux/static/stable/x86_64/

 下载命令:

查看centos7内核版本:uname -r

离线安装包:wget  https://download.docker.com/linux/static/stable/x86_64/docker-18.09.9.tgz

解压安装包:tar -zxvf docker-18.09.9.tgz

复制到/usr/bin目录:cp docker/* /usr/bin/

创建/etc/systemd/system/docker.service文件,并写入如下内容,注意要修改

--insecure-registry=127.0.0.1,替换为虚拟机的IP:

[Unit]
Description=Docker Application Container Engine
documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
  
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
  
[Install]
WantedBy=multi-user.target
添加执行权限:chmod +x /etc/systemd/system/docker.service

重载所有配置文件(包括docker.service):systemctl daemon-reload

启动docker:systemctl start docker

设置开启启动:systemctl enable docker.service

查看docker启动状态:systemctl status docker

查看docker版本:docker --version

配置docker下载加速:

修改或创建daemon配置文件/etc/docker/daemon.json来使用加速器,配置阿里云加速(配置提速不是一般快),需要重启服务,见该网站的操作文档

阿里云登录 - 欢迎登录阿里云,安全稳定的云计算服务平台

“starting container process caused “process_linux.go:430: container init caused “write /proc/self/attr/keycreate: permission denied””: unknown.
类似于如上报错,网上查证说是docker与linux的版本不一致导致,最终发现是linux的selinux的问题(也不算问题,这是linux自带的安全策略),修改/etc/selinux下的config文件,并将ELINUX属性改为disabled

docker下载elasticsearch镜像:docker pull elasticsearch:7.14.2

docker network create somenetwork
docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.14.2

 安装elasticsearch-head

#拉取镜像
docker pull mobz/elasticsearch-head:5

#创建容器
docker create --name elasticsearch-head -p 9100:9100 mobz/elasticsearch-head:5

#启动容器
docker start elasticsearch-head

在容器中开启一个交互模式的终端(一般用于修改容器):

        docker exec -it /bin/bash

在容器中修改elasticsearch的config/elasticsearch.yml文件,在文件的最后追加两行

http.cors.enabled: true

http.cors.allow-origin: "*"

重启容器:docker restart

查询正在运行的容器:docker ps -a

docker删除指定镜像文件:docker rmi

删除所有未运行的容器:docker rm $(sudo docker ps -a -q)

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

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

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