如何在centos 6.5 下利用docker里部署elasticsearch

前端之家收集整理的这篇文章主要介绍了如何在centos 6.5 下利用docker里部署elasticsearch前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
安装docker


[root@localhost ~]# uname -r
2.6.32-431.el6.x86_64

[root@localhost ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m
注意其他的源可能导致你的内核和docker的版本不一致,需要升级内核至3.x。

安装:
[root@localhost ~]# rpm -ivh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.JN76fI: Header V3 RSA/SHA256 Signature,key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
yum -y install epel-release
yum -y install docker-io
service docker start
chkconfig docker on

注意其他的源可能导致你的内核和docker的版本不一致,需要升级内核至3.x。


yum install device-mapper-event-libs

下载镜像
docker pull elasticsearch:2

mkdir -p /es/{data01,data02,logs,elasticsearch}
chown elasticsearch.elasticsearch -R /es

docker cp es/ es:/etc/elasticsearch/ docker里配置cp到主机,之后修改配置文件

docker exec -it es bash

[root@bogon ~]# cd /es/elasticsearch/
[root@bogon elasticsearch]# ls
elasticsearch.yml logging.yml scripts


[root@bogon elasticsearch]#
chmod 777 -R /es/

由于本机还有一个ES,怕端口冲突,因此端口做了下更改如下

[root@bogon elasticsearch]# cat elasticsearch.yml
network.host: 0.0.0.0
path.data: /data01,/data02
path.logs: /logs
http.port: 9292
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.ping.unicast.hosts: ["10.80.1.11","10.80.1.12","10.80.1.13","10.80.1.14","10.80.1.15"]
transport.tcp.port: 9393

启动ES
docker run --net=host -d -p 9292:9292 -p 9393:9393 --name es -v /es/elasticsearch:/usr/share/elasticsearch/config -v /es/data01:/data01 -v /es/data02:/data02 -v /es/logs:/logs -u root b4c7b5ea84aa


time="2017-10-20T15:26:08+08:00" level="info" msg="+job serveapi(unix:///var/run/docker.sock)" time="2017-10-20T15:26:08+08:00" level="info" msg="WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64,which might be unstable running docker. Please u pgrade your kernel to 3.8.0. time="2017-0-20T15:26:08+08:00" level="info" msg="Listening for HTTP on unix (/var/run/docker.sock)" /usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with_deferred_remove,version Base not defined in file libdevmapper.so.1.02 with link time r eference 解决办法: 执行:yum upgrade device-mapper-libs

原文链接:https://www.f2er.com/centos/375513.html

猜你在找的CentOS相关文章