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 很简单,本地构建然后 ...
随机推荐
- ID基本操作(复制页面)(移动页面)(调整跨页页数)(版面调整)5.16
1.在页面面板中选择要复制的页面.拖动到新建页面图标上就可以新建页面. 2.在页面面板中选择要复制的页面.点击右上角的下箭头选择直接复制跨页. 3.在页面面板中选择要移动的页面.用鼠标拖到要移动的地方 ...
- css清除常用默认样式表
/*公共样式*/ html, body, div, ul, li, h1, h2, h3, h4, h5, h6, p, dl, dt, dd, ol, form, input, textarea, ...
- HTML DOM 属性
innerHTML 属性 获取元素内容的最简单方法是使用 innerHTML 属性. innerHTML 属性对于获取或替换 HTML 元素的内容很有用. 实例 下面的代码获取 id="in ...
- 关于django的一些基础知识
1.中间件 中间件的作用 : 在全局范围内控制django的输入和输出的钩子函数 中间件中有5种方法: process_request : 请求进来时,进行验证 process_views : 路由匹 ...
- Scrapy爬虫框架中的两个流程
下面对比了Scrapy爬虫框架中的两个流程—— ① Scrapy框架的基本运作流程:② Spider或其子类的几个方法的执行流程. 这两个流程是互相联系的,可对比学习. 1 ● Scrapy框架的基本 ...
- 4 Django应用 第3部分(视图部分)
接着昨天写的那篇笔记,今天继续学习DJango中的内容.这一章主要是介绍Django中的视图部分. 4.1视图理念 4.2编写第一个视图 4.3编写更多的视图 4.4给视图编写功能 4.5render ...
- effective java——12考虑实现coparable接口
float和double类型的主要设计目标是为了科学计算和工程计算.他们执行二进制浮点运算,这是为了在广域数值范围上提供较为精确的快速近似计算而精心设计的.然而,它们没有提供完全精确的结果,所以不应该 ...
- binary and out mode to open a file
When I use binary and out mode to open a exist file, and to modify the 4th and 8th byte data to 0x78 ...
- java中有关初始化的问题
在类的内部,变量定义的先后顺序决定了初始化顺序,即使变量定义分散在方法定义之外,它们依旧会在任何方法(包括构造器)被调用之前得到初始化 其中初始化的顺序先是静态对象,其后是非静态对象 例如: clas ...
- 入门项目 A3 src 主代码
import json # 调度内置 json 模块,用于数列化输入输出,相比eval,功能更全面,融合度更高from conf import settings # 从配置文件configure (包 ...