doris 0.9.0版本docker镜像制作与使用
1. 安装docker
详情请参见本人博客
2. 编译doris
详情请参见doris官网文档
3. 在编译好的doris output文件夹下编写两个Dockerfile
3.1 Dockerfile_fe
FROM centos:centos7.5.1804 RUN mkdir /home/palo/run/ -p # copy jdk and palo binary
COPY jdk1..0_131/ /home/palo/run/jdk1..0_131/
COPY fe/ /home/palo/run/fe/ # set java home
ENV JAVA_HOME /home/palo/run/jdk1..0_131/ # set fe port: http/thrift/mysql/bdbje
EXPOSE # fe log and meta-data
VOLUME ["/home/palo/run/fe/conf" i"/home/palo/run/fe/log" "/home/palo/run/fe/palo-meta"] WORKDIR /home/palo/run/fe/ CMD ["/bin/sh","/home/palo/run/fe/bin/start_fe.sh"]
3.2 Dockerfile_be
Centos 7 be docker file
FROM centos:centos7.5.1804
#FROM ubuntu:18.04 RUN mkdir -p /home/palo/run/ RUN yum -y update \
&& yum install -y binutils-devel \
&& yum -y clean all \
&& rm -rf /var/cache/yum # copy be
COPY be/ /home/palo/run/be/ # set be port: thrift/rpc/http/heartbeat
EXPOSE # be log,conf and data
VOLUME ["/home/palo/run/be/conf", "/home/palo/run/be/log", "/home/palo/run/be/data/"] WORKDIR /home/palo/run/be/
RUN ldd lib/palo_be CMD ["/bin/sh","/home/palo/run/be/bin/start_be.sh"]
Ununtu 18.04 be docker file
FROM ubuntu:18.04 RUN mkdir -p /home/palo/run/ RUN apt-get -y update \
&& apt-get install -y libbinutils \
&& apt-get -y clean all \
&& rm -rf /var/cache/yum
#set the shell command from dash (which is the default shell application in ubuntu) to
#bash which doris start command used.
&& ln -sf /bin/bash /bin/sh # copy be
COPY be/ /home/palo/run/be/ # set be port: thrift/rpc/http/heartbeat
EXPOSE # fe log and meta-data
VOLUME ["/home/palo/run/be/conf", "/home/palo/run/be/log", "/home/palo/run/be/data/"] WORKDIR /home/palo/run/be/
RUN ldd lib/palo_be CMD ["/bin/sh","/home/palo/run/be/bin/start_be.sh"]
Note: if build the binary files of be using ubuntu 18.04, and build the docker image using centos, because the ubuntu glibc version 2.27 and the centos 7 glibc version is lower than this ( currently, the highest version is 2.17), and this would cause the be process
is unable to start with error message:
start time: Sat Apr :: CST
/home/palo/run/be/lib/palo_be: error while loading shared libraries: libbfd-2.30-system.so: cannot open shared object file: No such file or directory
so it's nassary to make sure the be build glic version is compatable with the target images os version. And this is why I used two docker file to build the be docker image.
In summery:
if you build the doris be in centos, it's better to build the docker images in based on centos; and vice, it you build the binary on ubuntu, it's better to build the docker image based on ubuntu. In order to make glibc version compatable.
4. 制作docker镜像
4.1 下载jdk1.8.0_131.tar.gz到 output文件夹下并解压,具体可以到oracle官网下载
文件准备完成后的目录结构为
[druid@doris output]$ ls -l
total
drwxr-xr-x druid druid Apr : apache_hdfs_broker
drwxr-xr-x druid druid Apr : be
-rw-rw-r-- druid druid Apr : Dockerfile_be
-rw-rw-r-- druid druid Apr : Dockerfile_fe
drwxr-xr-x druid druid Apr : fe
drwxr-xr-x druid druid Mar jdk1..0_131
4.2 制作fe镜像
[druid@palo output]$ sudo docker build -t lenmom/doris:fe-0.9.0 -f Dockerfile_fe .
[sudo] password for druid:
Sending build context to Docker daemon .027GB
Step / : FROM centos:centos7.5.1804
---> cf49811e3cdb
Step / : RUN mkdir /home/palo/run/ -p
---> Using cache
---> ffe6e7a05650
Step / : COPY jdk1..0_131/ /home/palo/run/jdk1..0_131/
---> a0b9c437e9f7
Step / : COPY fe/ /home/palo/run/fe/
---> a7706aa9939b
Step / : ENV JAVA_HOME /home/palo/run/jdk1..0_131/
---> Running in bd436cb488d5
Removing intermediate container bd436cb488d5
---> 9e10bc76f4b5
Step / : EXPOSE
---> Running in de0d71ee1f27
Removing intermediate container de0d71ee1f27
---> 16600856447f
Step / : WORKDIR /home/palo/run/fe/
---> Running in 2cfe3e4bc04e
Removing intermediate container 2cfe3e4bc04e
---> fc999dfbc914
Step / : CMD "bin/start_fe.sh"
---> Running in fafb6d98095d
Removing intermediate container fafb6d98095d
---> 62efbd2bbea0
Successfully built 62efbd2bbea0
Successfully tagged doris:fe-0.9.
4.3 制作be镜像
[druid@palo output]$ sudo docker build -t lenmom/doris:be-0.9.0 -f Dockerfile_be .
Sending build context to Docker daemon .163GB
Step / : FROM centos:centos7.5.1804
---> cf49811e3cdb
Step / : RUN mkdir /home/palo/run/ -p
---> Running in 2ae7543e4f3a
Removing intermediate container 2ae7543e4f3a
---> 635d3dd01e5b
Step / : COPY be/ /home/palo/run/be/
---> 825e46597c07
Step / : EXPOSE
---> Running in 21e7742b6da5
Removing intermediate container 21e7742b6da5
---> c735c437a771
Step / : VOLUME ["/home/palo/run/be/conf", "/home/palo/run/be/log", "/home/palo/run/be/data/"]
---> Running in 456c4f54c79a
Removing intermediate container 456c4f54c79a
---> 392386745a0a
Step / : WORKDIR /home/palo/run/be/
---> Running in eac0b97ffdba
Removing intermediate container eac0b97ffdba
---> a488181610ba
Step / : CMD "bin/start_be.sh"
---> Running in 871bee0625c6
Removing intermediate container 871bee0625c6
---> cf8f3297619a
Successfully built cf8f3297619a
Successfully tagged lenmom/doris:be-0.9.
4.4 查看镜像信息
[druid@palo output]$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
lenmom/doris fe-0.9. ecd903182693 minutes ago 649MB
lenmom/doris be-0.9. cf8f3297619a minutes ago 855MB
centos centos7.5.1804 cf49811e3cdb weeks ago 200MB
5. 导出镜像与上传镜像
5.1 导出镜像到本地
#命令格式:
#docker save -o 要保存的文件名 要保存的镜像
sudo docker save -o doris-fe-0.9.-docker.img lenmom/doris:fe-0.9. #导出fe镜像到本地,默认导出到当前目录,可以指定完整参数
sudo docker save -o doris-be-0.9.-docker.img lenmom/doris:be-0.9. #导出be镜像到本地,默认导出到当前目录,可以指定完整参数
导出后的结果看下图:
5.2 导入镜像
使用5.1中导出的镜像,可以在其他机器的部署环境中,使用load命令导入镜像,直接使用即可
#命令格式:
sudo docker load --input 文件
#或者
sudo docker load < 文件名
针对本例中的两个镜像文件,操作命令为:
sudo docker load --input doris-be-0.9.-docker.img #导入be镜像
sudo docker load --input doris-fe-0.9.-docker.img #导入fe镜像
5.3 上传镜像
命令格式为: docker push NAME[:TAG]
注意:如果为个人注册的docker hub账号,一定要在镜像名称前面加上自己的docker hub用户名,否则提交上传会失败,出现类似下面的错误
Error response from daemon: pull access denied for xxx, repository does not exist or may require 'docker login'
上传镜像前,需要使用自己的docker hub账号登陆,然后才可以上传镜像文件,下面来操作一个波次看看
5.1 登陆docker hub
输入sudo docker login,然后输入用户名,密码即可。
[druid@palo output]$ sudo docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: {YOUR-DOCKER-HUB-ID}
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded
5.2 不带用户名的镜像上传会失败
修改lenmom/doris:be-0.9.0镜像名称为doris:be-0.9.0,即去掉签名的用户id,修改之前的镜像列表为
$sudo docker tag lenmom/doris:be-0.9. doris:be-0.9. #创建不带用户id的镜像别名
$sudo docker rmi lenmom/doris:be-0.9. #删除带用户id的镜像
Untagged: lenmom/doris:be-0.9.
$sudo docker images #查看镜像列表,带用户id的be镜像应该消失了
REPOSITORY TAG IMAGE ID CREATED SIZE
lenmom/doris fe-0.9. ecd903182693 minutes ago 649MB
doris be-0.9. cf8f3297619a About an hour ago 855MB
centos centos7.5.1804 cf49811e3cdb weeks ago 200MB
现在上传该镜像,上传应该会失败
$sudo docker push doris:be-0.9.
Error response from daemon: pull access denied for doris, repository does not exist or may require 'docker login'
失败的原因是定位仓库的时候发现没有doris仓库,如果镜像带有用户id,那么默认的仓库是/id/tagname。
5.3 上传带用户id的镜像
[druid@palo194 output]$ sudo docker tag doris:be-0.9. lenmom/doris:0.9. #添加带用户id的镜像名称
[sudo] password for druid:
[druid@palo194 output]$ sudo docker rmi doris:be-0.9. #删除不带用户id的镜像名称
Untagged: doris:be-0.9.
[druid@palo194 output]$ sudo docker images #查看镜像列表
REPOSITORY TAG IMAGE ID CREATED SIZE
lenmom/doris fe-0.9. ecd903182693 About an hour ago 649MB
lenmom/doris be-0.9. cf8f3297619a About an hour ago 855MB
centos centos7.5.1804 cf49811e3cdb weeks ago 200MB
[druid@palo194 output]$ sudo docker push lenmom/doris:be-0.9.0 #上传带用户id的镜像,上传成功
The push refers to repository [docker.io/lenmom/doris]
270d8b1169bb: Preparing
1d301fa1efc4: Preparing
4826cdadf1ef: Preparing
能够上传成功关键在docker.io/lenmom/doris,docker就是靠用户id来定位仓库地址的!!
6. 通过docker来使用制作好的镜像
6.1 启动fe容器
sudo docker run --name doris-fe -p : -p : -p : -p : \
-v /home/lenmom/workspace/software/doris-docker-master/fe/log:/home/palo/run/fe/log \
-v /home/lenmom/workspace/software/doris-docker-master/fe/palo-meta:/home/palo/run/fe/palo-meta \
-v /home/lenmom/workspace/software/doris-docker-master/fe/conf:/home/palo/run/fe/conf/ \
--link doris-be \
-v /etc/localtime:/etc/localtime:ro lenmom/doris:fe-0.9.
Note: this create a docker container named doris-fe, after the start up ,we can see the results in the directory, and if we want to operate the be node to setup a cluster, we should start up the be node first, because to set up a cluster, the fe node need to know the be's ip address and vice not(because the fe would send the it's address to be during the hearbeat process. This is why we add the -link to container instance of doris-be!
and you can start a mysql container with a link to the doris-fe container just started to operate the fe instance.
sudo docker run -it --name mysql --link doris-fe mysql:5.7 /bin/bash
when the mysql container started, we can login the doris-fe in inside the mysql container:
root@d4df95bc2460:/# mysql -h doris-fe -P -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.1. Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
row in set (0.03 sec) mysql> clear
mysql> exit
Bye
root@d4df95bc2460:/# exit
6.2 启动be容器
sudo docker run -d --name doris-be -p : -p : -p : -p : \
-v /home/lenmom/workspace/software/doris-docker-master/be/log:/home/palo/run/be/log \
-v /home/lenmom/workspace/software/doris-docker-master/be/storage:/home/palo/run/be/data \
-v /home/lenmom/workspace/software/doris-docker-master/be/conf:/home/palo/run/be/conf/ \
-v /etc/localtime:/etc/localtime:ro \
lenmom/doris:be-0.9.0
and if we can go into the doris-be container using command
sudo docker exec -it doris-be bash
after enter the container, we can see the be instance has been launched now.
6.3 set up cluster
sudo docker run -it --name mysql --link doris-fe mysql:5.7 /bin/bash
after the mysql instance started, we would enter the shell terminal, then login doris-fe using mysql-client
lenmom@M1701:~/workspace/software/doris-docker-master/fe$ sudo docker run -it --rm --name mysql -p : -e MYSQL_ROOT_PASSWORD=root \
> -v /home/lenmom/workspace/software/mysql:/var/lib/mysql \
> -v /home/lenmom/workspace/software/mysql/mysql-conf/mysql:/etc/mysql \
> --link doris-fe \
> mysql:5.7 bash
[sudo] password for lenmom:
root@dcc6e94ab15b:/# mysql -h doris-fe -P -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.1. Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show frontends;
+-------------------------------+------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+
| Name | IP | EditLogPort | HttpPort | QueryPort | RpcPort | Role | IsMaster | ClusterId | Join | Alive | ReplayedJournalId | LastHeartbeat | IsHelper | ErrMsg |
+-------------------------------+------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+
| 172.17..3_9010_1555911447430 | 172.17.0.3 | | | | | FOLLOWER | true | | true | true | | -- :: | true | |
+-------------------------------+------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+
row in set (0.03 sec) mysql> show backends;
Empty set (0.01 sec) mysql> alter system add backend 'doris-be:9050';
Query OK, rows affected (0.02 sec) mysql> show backends;
+-----------+-----------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+--------+
| BackendId | Cluster | IP | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime | LastHeartbeat | Alive | SystemDecommissioned | ClusterDecommissioned | TabletNum | DataUsedCapacity | AvailCapacity | TotalCapacity | UsedPct | ErrMsg |
+-----------+-----------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+--------+
| | default_cluster | 172.17.0.2 | | | | | -- :: | -- :: | true | false | false | | . | 22.826 GB | 70.115 GB | 67.45 % | |
+-----------+-----------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+--------+
row in set (0.00 sec) mysql>
Here, we have set up a cluster using the doris-fe and doris-be container instance which has just launched and you can can docker-compose or docker-swarm to set up more instacnes of nodes and setting up clusters based on docker.
Notes: if we want to login fe docker container in the host machine using mysql-client, we should make sure the mysql client is less than 8.*, or else ,we may get the error message when login 127.0.0.1 on the docker host via mysql-client.
mysql -h 127.0.0.1 -P -uroot -p
Enter password:
ERROR (): Access denied for user 'root' (using password: YES)
notes:
a). we can launch multiple be instance to set multiple be instance cluster using docker container.
b). Do make sure the host mahine's mysql-client version is less than 8.0* if we want to login the fe docker instance via mysql-client on the docker host machine.
c). The be docker instance should be launched before the fe docker instance, because when set up cluster via fe,the fe need to be aware of the existance of the be docker instacne.
d) when launch the fe docker instance, all the be docker instance should be linked by the fe docker instance.
Have fun with doris!
doris 0.9.0版本docker镜像制作与使用的更多相关文章
- MySQL、MongoDB、Redis数据库Docker镜像制作
MySQL.MongoDB.Redis数据库Docker镜像制作 在多台主机上进行数据库部署时,如果使用传统的MySQL的交互式的安装方式将会重复很多遍.如果做成镜像,那么我们只需要make once ...
- 《Docekr入门学习篇》——Docker镜像制作
Docker镜像制作 Docker镜像的构建分为两种,一种是手动构建,一种是dockerfile(自动构建) 手动构建 基于centos镜像进行构建制作Nginx镜像 [root@rbtnode1 ~ ...
- Docker 镜像制作教程:针对不同语言的精简策略
本系列文章将分为三个部分: 第一部分着重介绍多阶段构建(multi-stage builds),因为这是镜像精简之路至关重要的一环.在这部分内容中,我会解释静态链接和动态链接的区别,它们对镜像带来的影 ...
- docker研究-4 docker镜像制作
这次实验以centos镜像为基础镜像进行相关docker镜像制作. 1. 下载centos镜像 [root@localhost ~]# docker pull centosUsing default ...
- Nginx+PHP7.3.9 Docker镜像制作
最近因项目需要制作了多个版本的php docker镜像,制作过程可谓是一波三折,因基于yum的方式安装php的方式在安装扩展插件时很不方便,不容易找到插件对应的yum源,所以PHP在docker镜像中 ...
- docker镜像制作必备技能
正文 使用过docker的都知道dockerfile,其用于定义制作镜像的流程,由一系列命令和参数构成的脚本,这些命令应用于基础镜像并最终创建一个新的镜像.可参考往期文章学习:docker基础知识整理 ...
- 实战【docker 镜像制作与使用】
一.制作docker 镜像 使用spring boot 构建一个简单的web 项目,返回 “Hello,World ”字符串,使用 Maven 打成 jar 包,使用的Linux 环境是 Centos ...
- Docker 镜像制作 CentOS+JDK+Tomcat
[root@localhost createImages]# ls apache-tomcat-.tar.gz server-jre-8u121-linux-x64.tar.gz [root@loca ...
- presto-gateway 试用以及docker 镜像制作
presto-gateway 是 lyft 团队开源 的prestodb 的工具.以下是一个简单的试用,以及碰到问题的解决 还有就是docker 镜像的制作 Dockerfile 很简单,本地构建然后 ...
随机推荐
- window.localStorag使用
H5本地缓存: 删除: window.localStorage.removeItem("parentNode") 写入: window.localStorage.setItem(& ...
- python3-连接MySQL(mysql.connector与MySQLdb区别)
import mysql.connector cnx = mysql.connector.connect(user='scott', password='tiger',host='127.0.0.1' ...
- sass command
compass create --bare --sass-dir "sass" --css-dir "css" --javascripts-dir " ...
- vsCode---进行HTML文件编辑与浏览器运行
发现vsCode没有明显的绿色三角箭头指示程序运行. 那么想运行一个html文件咋办,可以直接去文件存放地用浏览器打开便可以了. 但是这样也挺麻烦的, 我们需要在vscode里商城搜索两个插件来支持我 ...
- Python—内置函数
内置函数 内置函数补充 all: 所有iterable类型,包含的元素要全为真才返回真 >>> all([0,-1,5]) False >>> all([-1,5 ...
- mysql sql文件批量处理
简单动作复杂化,导致处理文件误入坑, 数据库拷贝,备份还原是每个面向对象的开发人员避免不了的动作,在数据库使用中,习惯性的使用第三方数据库管理软件,最近需要做数据库迁移,导出的批量sql文件不知如何区 ...
- 为Linux技术学习推荐看的书籍—《Linux就该这么学》
成长,是一种经历:经历,是一种人生的体验.人生的意义不在于我们拥有了什么,而在于从中我们体悟了什么.在这短短的三年,却在我的人生中弥足珍贵,在脑海中记忆犹新,在这大学三年里,我从一个莽撞少年成长为一名 ...
- Ubuntu18.04 搭建zookeeper单机版集群
一台电脑启动三个虚拟机比较折腾,这里就用一台虚拟机模拟一下zk集群. 1.后台下载安装包到 /opt目录 sudo wget -b http://archive.apache.org/dist/zoo ...
- .net core WebApi Interlocked配合ManualResetEventSlim实现并发同步
由于项目有某种需求,在WebApi中,有大量的请求需要操作相同的数据,因此需要用到并发同步机制去操作共享的数据. 本次配合使用Interlocked和ManualResetEventSlim来实现并发 ...
- 黄金点游戏 结队i项目
结对编程——黄金点游戏 本次的结对编程的项目是黄金点游戏,我的结对对象是冯雨倩,我们的编程能力都不太好,而且都对C语言更熟悉些,因此我们决定用C语言来实现. (1)分工:角色分配:冯雨倩是领航员, ...