在Ubuntu20.04安装StarRocks On Docker并在DataGrip配置JDBC协议连接容器内StarRocks2.3.2

Posted 虎鲸不是鱼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Ubuntu20.04安装StarRocks On Docker并在DataGrip配置JDBC协议连接容器内StarRocks2.3.2相关的知识,希望对你有一定的参考价值。

在Ubuntu20.04安装StarRocks On Docker并在DataGrip配置JDBC协议连接容器内StarRocks

前言

前阵子在Ubuntu20.04单机部署了Doris1.1:https://lizhiyong.blog.csdn.net/article/details/126338539

StarRocks之前较DorisDB,光看名字就知道和Apache Doris师出同门,这俩好基友的爱恨情仇笔者这里也不去八卦了。。。

这次就尝试部署一个DorisDB,也就是近期大火的StarRocks。由于种种原因,笔者部署在Docker上。

使用的Docker虚拟机环境:https://lizhiyong.blog.csdn.net/article/details/126761470

上述环境已经安装了Docker并且配置了镜像加速。

简介

官网:https://www.starrocks.com/zh-CN/index

可以从官网看出StarRocks官方定位:新一代极速全场景MPP数据库。

并且官方描述显示,StarRocks可以支持语句和、大宽表、星型/雪花模型,并且可以大规模实时写入,秒级实时性保证,并且可以同时高效读写。。。如果不是过度夸张,那么按照这描述看起来就很牛x的样子差不多真能满足各种数仓的要求了。

社区版

根据官网,可以白piao社区版。。。社区版的mysql同步支支持数据同步,并且不能用StarRocks Manager这个专门管理StarRocks的组件。此外白piao版对BI的兼容性支持弱【和Doris一样支持MySQL协议,所以也不是完全不能用作BI】,然后自己遇到的问题自己解决或者找社区的技术支持。

社区版下载

安装包官方下载地址:https://www.starrocks.com/zh-CN/download/community

看到这里操作系统只能选CentOS 7,笔者隐约有种不详的预感。。。

Release Notes:https://docs.starrocks.com/zh-cn/latest/release_notes/release-2.3

如论如何笔者要安装的肯定是目前最新的2.3.2,不行再想办法!!!

官方单节点部署手册

官网文档:https://docs.starrocks.com/zh-cn/latest/quick_start/Deploy

前提条件:

在部署 StarRocks 之前,请确保如下环境要求已满足。

分类描述说明
硬件要求集群至少拥有两台物理或虚拟节点。BE 节点 CPU 需支持 AVX2 指令集。各节点间需要通过万兆网卡及万兆交换机连接。FE 节点建议配置 8 核 或以上 CPU,16GB 或以上内存。BE 节点建议配置 16 核 或以上 CPU,64GB 或以上内存。通过运行 `cat /proc/cpuinfo
操作系统所有节点操作系统需为 CentOS(7 或以上)。
软件要求所有节点需安装 Java Development Kit(1.8 或以上)。客户端节点需安装 MySQL 客户端(5.5 或以上)。
系统环境集群时钟需保持同步。用户需要有设置 ulimit -n 权限。

说明 依据不同的工作负载复杂性,StarRocks 每个 CPU 线程每秒可以处理 10M 至 100M 行数据。您可以据此估计集群中需要多少 CPU 线程能够满足您的要求。而 StarRocks 在存储数据时利用列存储和压缩,可以达到 4-10 倍的压缩比,您可以使用该数据来估计集群所需的存储量。

根据官网按照文档的描述,显然是只能用CentOS 7【这里还显示可以用CentOS 7以上,但是CentOS 8都停更多久了。。。】很是遗憾。。。和Doris相比,StarRocks对操作系统的支持较弱,只支持CentOS 7。。。意味着不支持Ubuntu等系统。官方不支持不代表完全不能用!!!但是自己适配可能又得好久解决各种奇怪的问题,作为非专业运维的开发人员,还是应该将更多精力放在开发而非运维上,专业的事情交给专业的人去做!!!

官方Docker部署手册

官网文档:https://docs.starrocks.com/zh-cn/latest/administration/deploy_with_docker

前提条件:

分类描述
硬件要求CPU 需支持 AVX2 指令集建议配置 8 核 或以上 CPU,16GB 或以上内存。
操作系统CentOS(7 或以上)
软件要求DockerMySQL 客户端(5.5 或以上)

居然这里还是要求CentOS 7,醉了,先试试再说。理论上Docker是可以无视Linux发行版之间的细微区别的。

使用Docker部署StarRocks2.3.2的步骤

主要还是参考官方文档。先照着一步一步操作。

创建 Dockerfile

创建以下 Dockerfile:

FROM centos:centos7

# Prepare StarRocks Installer.
RUN yum -y install wget
RUN mkdir -p /data/deploy/ 
RUN wget -SO /data/deploy/StarRocks-2.3.2.tar.gz https://download.starrocks.com/zh-CN/download/request-download/49/StarRocks-2.3.2.tar.gz
RUN cd /data/deploy/ && tar zxf StarRocks-2.3.2.tar.gz

# Install Java JDK.
RUN yum -y install java-1.8.0-openjdk-devel.x86_64
RUN rpm -ql java-1.8.0-openjdk-devel.x86_64 | grep bin$
RUN /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b09-1.el7_9.x86_64/bin/java -version

# Create directory for FE meta and BE storage in StarRocks.
RUN mkdir -p /data/deploy/StarRocks-2.3.2/fe/meta
RUN jps
RUN mkdir -p /data/deploy/StarRocks-2.3.2/be/storage

# Install relevant tools.
RUN yum -y install mysql net-tools telnet

# Run Setup script.
COPY run_script.sh /data/deploy/run_script.sh
RUN chmod +x /data/deploy/run_script.sh
CMD /data/deploy/run_script.sh

按照官网描述,要修改版本号及下载的URL。版本号当然是统一改2.3.2。下载地址由于有CDN加速,可能经常会变化,读者可以自行获取最新地址,笔者的地址可能不久后就就过时了。

创建脚本文件

上边的DockerFile要运行一个脚本,但是脚本目前还没有创建,当然要先创建脚本【其实在容器里也可以创建脚本,照着官方文档先操作一波】:

#!/bin/bash

# Set JAVA_HOME.
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64

# Start FE.
cd /data/deploy/StarRocks-2.3.2/fe/bin/
./start_fe.sh --daemon

# Start BE.
cd /data/deploy/StarRocks-2.3.2/be/bin/
./start_be.sh --daemon

# Sleep until the cluster starts.
sleep 30;

# Set BE server IP.
IP=$(ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk 'print $2')
mysql -uroot -h$IP -P 9030 -e "alter system add backend '$IP:9050';"

# Loop to detect the process.
while sleep 60; do
  ps aux | grep starrocks | grep -q -v grep
  PROCESS_STATUS=$?

  if [ PROCESS_STATUS -ne 0 ]; then
    echo "one of the starrocks process already exit."
    exit 1;
  fi
done

这个脚本也没啥毛病,由于DockerFile是切换到/data/deploy/路径执行,所以安装包解压后也是在该路径下。基本就是简单地切换路径和单节点启动FE和BE,与Doris类似。

这个脚本同样是只需要修改StarRocks的版本即可。

搭建Docker镜像

docker build --no-cache --progress=plain -t starrocks:1.0 .

一定要看清楚这个点【.】!!!

一定要看清楚这个点【.】!!!

一定要看清楚这个点【.】!!!

重要的话说三遍!!!

这样的Docker命令显然一定是在当前DockerFile的及shell脚本的路径下执行。

启动Docker容器

docker run -p 9030:9030 -p 8030:8030 -p 8040:8040 --privileged=true -itd --name starrocks-test starrocks:1.0

使用MySQL Client连接Docker内的StarRocks

mysql -uroot -h127.0.0.1 -P 9030

执行SQL验证功能

CREATE DATABASE TEST;

USE TEST;

CREATE TABLE `sr_on_mac` (
 `c0` int(11) NULL COMMENT "",
 `c1` date NULL COMMENT "",
 `c2` datetime NULL COMMENT "",
 `c3` varchar(65533) NULL COMMENT ""
) ENGINE=OLAP 
DUPLICATE KEY(`c0`)
PARTITION BY RANGE (c1) (
  START ("2022-02-01") END ("2022-02-10") EVERY (INTERVAL 1 DAY)
)
DISTRIBUTED BY HASH(`c0`) BUCKETS 1 
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"storage_format" = "DEFAULT"
);


insert into sr_on_mac values (1, '2022-02-01', '2022-02-01 10:47:57', '111');
insert into sr_on_mac values (2, '2022-02-02', '2022-02-02 10:47:57', '222');
insert into sr_on_mac values (3, '2022-02-03', '2022-02-03 10:47:57', '333');


select * from sr_on_mac where c1 >= '2022-02-02';

实操部署StarRocks2.3.2 On Docker

笔者头铁一次,使用Ubuntu20.04尝试构建Docker镜像。

创建Dockerfile

先构建路径:

zhiyong@zhiyong-docker:~$ pwd
/home/zhiyong
zhiyong@zhiyong-docker:~$ mkdir -p /home/zhiyong/dockerproj/starrocks20220910
zhiyong@zhiyong-docker:~$ cd /home/zhiyong/dockerproj/starrocks20220910/
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ ls -ltr
总用量 0
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ vim Dockerfile
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$

Dockerfile的内容不再赘述,上方已经写了改好的Dockerfile。

保存后便完成了创建Dockerfle的步骤。接下来就是创建这个叫run_srcipt.sh的脚本。

创建启动脚本

zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ pwd
/home/zhiyong/dockerproj/starrocks20220910
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ vim run_script.sh

脚本内容不再赘述,上方已经写了改好的脚本内容。

保存后便完成了创建启动脚本的步骤。准备好了DockerFile和启动脚本后就可以构建镜像。

搭建镜像

zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ pwd
/home/zhiyong/dockerproj/starrocks20220910
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ ll
总用量 16
drwxrwxr-x 2 zhiyong zhiyong 4096 910 01:36 ./
drwxrwxr-x 3 zhiyong zhiyong 4096 910 01:24 ../
-rw-rw-r-- 1 zhiyong zhiyong  887 910 01:29 Dockerfile
-rw-rw-r-- 1 zhiyong zhiyong  693 910 01:34 run_script.sh
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker build --no-cache --progress=plain -t starrocks:1.0 .

StarRocks镜像比较大,要多等一会儿。。。解压也需要很久。然后就会报错:

Complete!
Removing intermediate container 8d6ccc75590a
 ---> 2a6a0faca739
Step 7/15 : RUN rpm -ql java-1.8.0-openjdk-devel.x86_64 | grep bin$
 ---> Running in 73ae0533b376
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64/bin
Removing intermediate container 73ae0533b376
 ---> c826b7da0469
Step 8/15 : RUN /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b09-1.el7_9.x86_64/bin/java -version
 ---> Running in aad6ae527d84
/bin/sh: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b09-1.el7_9.x86_64/bin/java: No such file or directory
The command '/bin/sh -c /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b09-1.el7_9.x86_64/bin/java -version' returned a non-zero code: 127
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$

显然是java环境的路径不对。。。

解决Java路径的问题

先进入容器看看具体路径:

zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ pwd
/home/zhiyong/dockerproj/starrocks20220910
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker ps -a
CONTAINER ID   IMAGE                                       COMMAND                  CREATED         STATUS                       PORTS                                                                                                                                                                                                                                                                                                                                                                                                       NAMES
aad6ae527d84   c826b7da0469                                "/bin/sh -c '/usr/li…"   5 minutes ago   Exited (127) 5 minutes ago                                                                                                                                                                                                                                                                                                                                                                                                               modest_kare
778198dd36a2   bc0c4e146857                                "/home/admin/entrypo…"   2 days ago      Up 2 days                    0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 0.0.0.0:7070->7070/tcp, :::7070->7070/tcp, 0.0.0.0:8032->8032/tcp, :::8032->8032/tcp, 0.0.0.0:8042->8042/tcp, :::8042->8042/tcp, 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp, 0.0.0.0:9083->9083/tcp, :::9083->9083/tcp, 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:50070->50070/tcp, :::50070->50070/tcp   zen_darwin
2c165b6f19ec   apachekylin/apache-kylin-standalone:4.0.0   "/home/admin/entrypo…"   2 days ago      Exited (137) 2 days ago                                                                                                                                                                                                                                                                                                                                                                                                                  nice_gould
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker run -ti c826b7da0469 /bin/bash
[root@4e920b6a2db0 jvm]# pwd
/usr/lib/jvm
[root@4e920b6a2db0 jvm]# ll
total 4
lrwxrwxrwx 1 root root   26 Sep  9 17:45 java -> /etc/alternatives/java_sdk
lrwxrwxrwx 1 root root   32 Sep  9 17:45 java-1.8.0 -> /etc/alternatives/java_sdk_1.8.0
lrwxrwxrwx 1 root root   40 Sep  9 17:45 java-1.8.0-openjdk -> /etc/alternatives/java_sdk_1.8.0_openjdk
drwxr-xr-x 7 root root 4096 Sep  9 17:45 java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64
lrwxrwxrwx 1 root root   34 Sep  9 17:45 java-openjdk -> /etc/alternatives/java_sdk_openjdk
lrwxrwxrwx 1 root root   21 Sep  9 17:44 jre -> /etc/alternatives/jre
lrwxrwxrwx 1 root root   27 Sep  9 17:44 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx 1 root root   35 Sep  9 17:44 jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk
lrwxrwxrwx 1 root root   51 Sep  9 17:44 jre-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64 -> java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64/jre
lrwxrwxrwx 1 root root   29 Sep  9 17:44 jre-openjdk -> /etc/alternatives/jre_openjdk

可以看到JDK的版本号和Dockerfile写死的版本不对应,写死的路径当然也就无法正常执行。显然要改Dockerfile的Java路径。脚本的Java_HOME不用说,肯定也得一起改!!!

Dockerfile需要修改:

RUN /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b09-1.el7_9.x86_64/bin/java -version

将其修改为:

RUN /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64/bin/java -version

脚本文件需要修改:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64

将其修改为:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64

修改后:

[root@4e920b6a2db0 java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64]# exit
exit
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker ps -a
CONTAINER ID   IMAGE                                       COMMAND                  CREATED          STATUS                        PORTS                                                                                                                                                                                                                                                                                                                                                                                                       NAMES
4e920b6a2db0   c826b7da0469                                "/bin/bash"              8 minutes ago    Exited (0) 2 seconds ago                                                                                                                                                                                                                                                                                                                                                                                                                  clever_tu
aad6ae527d84   c826b7da0469                                "/bin/sh -c '/usr/li…"   18 minutes ago   Exited (127) 18 minutes ago                                                                                                                                                                                                                                                                                                                                                                                                               modest_kare
778198dd36a2   bc0c4e146857                                "/home/admin/entrypo…"   2 days ago       Up 2 days                     0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 0.0.0.0:7070->7070/tcp, :::7070->7070/tcp, 0.0.0.0:8032->8032/tcp, :::8032->8032/tcp, 0.0.0.0:8042->8042/tcp, :::8042->8042/tcp, 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp, 0.0.0.0:9083->9083/tcp, :::9083->9083/tcp, 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:50070->50070/tcp, :::50070->50070/tcp   zen_darwin
2c165b6f19ec   apachekylin/apache-kylin-standalone:4.0.0   "/home/admin/entrypo…"   2 days ago       Exited (137) 2 days ago                                                                                                                                                                                                                                                                                                                                                                                                                   nice_gould
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ ll
总用量 16
drwxrwxr-x 2 zhiyong zhiyong 4096 910 01:36 ./
drwxrwxr-x 3 zhiyong zhiyong 4096 910 01:24 ../
-rw-rw-r-- 1 zhiyong zhiyong  887 910 01:29 Dockerfile
-rw-rw-r-- 1 zhiyong zhiyong  693 910 01:34 run_script.sh
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ vim Dockerfile
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ vim run_script.sh
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$

修改完成后就可以重新搭建镜像。

重新搭建镜像

zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ pwd
/home/zhiyong/dockerproj/starrocks20220910
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ ll
总用量 16
drwxrwxr-x 2 zhiyong zhiyong 4096 910 02:05 ./
drwxrwxr-x 3 zhiyong zhiyong 4096 910 01:24 ../
-rw-rw-r-- 1 zhiyong zhiyong  887 910 02:05 Dockerfile
-rw-rw-r-- 1 zhiyong zhiyong  693 910 02:05 run_script.sh
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker images
REPOSITORY                            TAG       IMAGE ID       CREATED          SIZE
<none>                                <none>    c826b7da0469   22 minutes ago   4.25GB
kylin_hive                            v1.0.0    bc0c4e146857   2 days ago       4.48GB
centos                                centos7   eeb6ee3f44bd   11 months ago    204MB
apachekylin/apache-kylin-standalone   4.0.0     a8a5fd0c0497   12 months ago    3.41GB
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$


zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker build --no-cache --progress=plain -t starrocks:1.0 .

然后又是重新拉取文件和解压。。。其实下载二进制安装包和解压放虚拟机本地执行可能更快点。。。主要还是心疼硬盘。。。

Complete!
Removing intermediate container 2a5f495902ef
 ---> e80cd89e0dbc
Step 13/15 : COPY run_script.sh /data/deploy/run_script.sh
 ---> ae35f0b31cb2
Step 14/15 : RUN chmod +x /data/deploy/run_script.sh
 ---> Running in e2cffc0963c4
Removing intermediate container e2cffc0963c4
 ---> 311a7694327d
Step 15/15 : CMD /data/deploy/run_script.sh
 ---> Running in 324f5431cbe7
Removing intermediate container 324f5431cbe7
 ---> fc10d618f4ff
Successfully built fc10d618f4ff
Successfully tagged starrocks:1.0
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker images
REPOSITORY                            TAG       IMAGE ID       CREATED          SIZE
starrocks                             1.0       fc10d618f4ff   40 seconds ago   4.52GB
<none>                                <none>    c826b7da0469   31 minutes ago   4.25GB
kylin_hive                            v1.0.0    bc0c4e146857   2 days ago       4.48GB
centos                                centos7   eeb6ee3f44bd   11 months ago    204MB
apachekylin/apache-kylin-standalone   4.0.0     a8a5fd0c0497   12 months ago    3.41GB
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker rmi c826b7da0469
Error response from daemon: conflict: unable to delete c826b7da0469 (must be forced) - image is being used by stopped container aad6ae527d84
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker ps -a
CONTAINER ID   IMAGE                                       COMMAND                  CREATED          STATUS                        PORTS                                                                                                                                                                                                                                                                                                                                                                                                       NAMES
4e920b6a2db0   c826b7da0469                                "/bin/bash"              24 minutes ago   Exited (0) 15 minutes ago                                                                                                                                                                                                                                                                                                                                                                                                                 clever_tu
aad6ae527d84   c826b7da0469                                "/bin/sh -c '/usr/li…"   34 minutes ago   Exited (127) 34 minutes ago                                                                                                                                                                                                                                                                                                                                                                                                               modest_kare
778198dd36a2   bc0c4e146857                                "/home/admin/entrypo…"   2 days ago       Up 2 days                     0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 0.0.0.0:7070->7070/tcp, :::7070->7070/tcp, 0.0.0.0:8032->8032/tcp, :::8032->8032/tcp, 0.0.0.0:8042->8042/tcp, :::8042->8042/tcp, 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp, 0.0.0.0:9083->9083/tcp, :::9083->9083/tcp, 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:50070->50070/tcp, :::50070->50070/tcp   zen_darwin
2c165b6f19ec   apachekylin/apache-kylin-standalone:4.0.0   "/home/admin/entrypo…"   2 days ago       Exited (137) 2 days ago                                                                                                                                                                                                                                                                                                                                                                                                                   nice_gould
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker rm 4e920b6a2db0
4e920b6a2db0
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker rm aad6ae527d84
aad6ae527d84
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker ps -a
CONTAINER ID   IMAGE                                       COMMAND                  CREATED      STATUS                    PORTS                                                                                                                                                                                                                                                                                                                                                                                                       NAMES
778198dd36a2   bc0c4e146857                                "/home/admin/entrypo…"   2 days ago   Up 2 days                 0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 0.0.0.0:7070->7070/tcp, :::7070->7070/tcp, 0.0.0.0:8032->8032/tcp, :::8032->8032/tcp, 0.0.0.0:8042->8042/tcp, :::8042->8042/tcp, 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp, 0.0.0.0:9083->9083/tcp, :::9083->9083/tcp, 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:50070->50070/tcp, :::50070->50070/tcp   zen_darwin
2c165b6f19ec   apachekylin/apache-kylin-standalone:4.0.0   "/home/admin/entrypo…"   2 days ago   Exited (137) 2 days ago                                                                                                                                                                                                                                                                                                                                                                                                               nice_gould
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker images
REPOSITORY                            TAG       IMAGE ID       CREATED          SIZE
starrocks                             1.0       fc10d618f4ff   5 minutes ago    4.52GB
<none>                                <none>    c826b7da0469   36 minutes ago   4.25GB
kylin_hive                            v1.0.0    bc0c4e146857   2 days ago       4.48GB
centos                                centos7   eeb6ee3f44bd   11 months ago    204MB
apachekylin/apache-kylin-standalone   4.0.0     a8a5fd0c0497   12 months ago    3.41GB
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker rmi c826b7da0469
Deleted: sha256:c826b7da04692ea2e13fc690b4d9fda6e52f07bcbaf9349fa0647403ed93f6b2
Deleted: sha256:9e828733df8dc04bfa14385e67ccc31f7457ce8d45b149c40b1823e10e037e24
Deleted: sha256:2a6a0faca7399825136bf25e32dacbf49ed084d5eb19dcec2026248a40ca1d69
Deleted: sha256:b11d5a9f760b049a2c98a7be659ee2a556ac02d3b39982610ff634880a82c54a
Deleted: sha256:c1b431883be9ffd738fae0b9c12f9baa5f7d632990e2eac0cac289c46ad4be16
Deleted: sha256:e3aa96114607ec314a53c80700ee5d191070ad9f9210ee8fe2cf38980fc9c0d1
Deleted: sha256:e44d123d9d3d7b97c0f4027ef2b4f2b393901ca9f4972fd496eafb995ff873e6
Deleted: sha256:a4db45210d7834fab2712dba9b9c7b9a28d5d6a0eeec49675fa09e52ebc84a8a
Deleted: sha256:45eaa057c6aa07d116756f4e7f7e0d8ec0c01fd0ea433e041b777fe491c617b6
Deleted: sha256:f851cafdc259f641fa1f2b2d3459cf69dd973af6e378748fd90322071c2baf15
Deleted: sha256:f69384827d83a59537eba6d722f9da5a0913f6bdf9940cde4c0ab88fddb966f4
Deleted: sha256:c4c8c76757b84ad9e8cf88b2b6c857f4dd400520e8e51c54e77cda7d0aa45b20
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker images
REPOSITORY                            TAG       IMAGE ID       CREATED         SIZE
starrocks                             1.0       fc10d618f4ff   6 minutes ago   4.52GB
kylin_hive                            v1.0.0    bc0c4e146857   2 days ago      4.48GB
centos                                centos7   eeb6ee3f44bd   11 months ago   204MB
apachekylin/apache-kylin-standalone   4.0.0     a8a5fd0c0497   12 months ago   3.41GB
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$

此时可以看到镜像构建成功。之前的2个容器太失败,镜像也是很失败,先删除再说。

启动Docker容器

zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker run -p 9030:9030 -p 8030:8030 -p 8040:8040 --privileged=true -itd --name starrocks-test starrocks:1.0
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo docker ps -a
CONTAINER ID   IMAGE                                       COMMAND                  CREATED          STATUS                    PORTS                                                                                                                                                                                                                                                                                                                                                                                                       NAMES
62eb7c89527e   starrocks:1.0                               "/bin/sh -c /data/de…"   20 seconds ago   Up 18 seconds             0.0.0.0:8030->8030/tcp, :::8030->8030/tcp, 0.0.0.0:8040->8040/tcp, :::8040->8040/tcp, 0.0.0.0:9030->9030/tcp, :::9030->9030/tcp                                                                                                                                                                                                                                                                             starrocks-test
778198dd36a2   bc0c4e146857                                "/home/admin/entrypo…"   2 days ago       Up 2 days                 0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 0.0.0.0:7070->7070/tcp, :::7070->7070/tcp, 0.0.0.0:8032->8032/tcp, :::8032->8032/tcp, 0.0.0.0:8042->8042/tcp, :::8042->8042/tcp, 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp, 0.0.0.0:9083->9083/tcp, :::9083->9083/tcp, 0.0.0.0:10000->10000/tcp, :::10000->10000/tcp, 0.0.0.0:50070->50070/tcp, :::50070->50070/tcp   zen_darwin
2c165b6f19ec   apachekylin/apache-kylin-standalone:4.0.0   "/home/admin/entrypo…"   2 days ago       Exited (137) 2 days ago                                                                                                                                                                                                                                                                                                                                                                                                               nice_gould
zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$

可以看到Docker容器这次成功启动。

使用MySQL Clien连接Docker内的StarRocks

由于StarRocks和Doris都兼容MySQL协议,所以都可以使用MySQL Client或者手写JDBC的方式连接到它们的FE【前端FE节点,而不是后端BE节点】。

zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ mysql -uroot -h127.0.0.1 -P 9030

Command 'mysql' not found, but can be installed with:

sudo apt install mysql-client-core-8.0     # version 8.0.30-0ubuntu0.20.04.2, or
sudo apt install mariadb-client-core-10.3  # version 1:10.3.34-0ubuntu0.20.04.1

zhiyong@zhiyong-docker:~/dockerproj/starrocks20220910$ sudo apt install mysql-client-core-8.0
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:
  mysql-client-core-8.0
升级了 在Ubuntu20.04安装StarRocks On Docker并在DataGrip配置JDBC协议连接容器内StarRocks2.3.2

ubuntu20.04使用终端命令安装谷歌Chrome浏览器稳定版

ubuntu20.04安装教程,ubuntu20.04配置教程

在 Ubuntu 20.04 上安装 R 的最佳方式是啥?

在 Ubuntu 20.04 上安装 MySQL 5.6

无法在 Ubuntu 20.04 上安装 ROS Melodic