使用docker部署单机测试版starrocks

2022-11-16 19:58:57 浏览数 (1)

官方文档

​​https://docs.starrocks.io/zh-cn/latest/administration/deploy_with_docker​​

在使用官方文档的安装的时候,遇到些问题(主要是jdk yum安装的版本变动导致的)。

我这里稍微优化了下,具体记录如下。

准备好离线安装包

代码语言:javascript复制
mkdir /usr/local/starrocks -pv
cd /usr/local/starrocks


wget https://download.starrocks.com/zh-CN/download/request-download/55/StarRocks-2.3.3.tar.gz

另外,再准备好 jdk-8u202-linux-x64.tar.gz 压缩包(或者yum在线下载也行,但是yum下载的默认情况下版本可能会有变化)


文件列表如下:
# root @ centos7-3 in /usr/local/starrocks [13:33:41] 
$ l
.rw-r--r-- root root 185 MB 2022-02-22 16:54:59  jdk-8u202-linux-x64.tar.gz
.rw-r--r-- root root 1.8 GB 2022-09-27 15:52:04  StarRocks-2.3.3.tar.gz
.rwxr-xr-x root root  91 B  2022-10-08 16:47:47  build.sh
.rwxr-xr-x root root 141 B  2022-10-08 16:48:19  run.sh
.rwxr-xr-x root root  65 B  2022-10-08 16:50:48  conn.sh
.rw-r--r-- root root 756 B  2022-11-07 12:33:32  Dockerfile
.rwxr-xr-x root root 551 B  2022-11-07 12:33:48  run_script.sh

准备dockerfile如下

代码语言:javascript复制
$ cat Dockerfile 
FROM centos:centos7

# Prepare StarRocks Installer.
RUN mkdir -p /data/deploy/ 
COPY StarRocks-2.3.3.tar.gz /data/deploy/StarRocks-2.3.3.tar.gz
RUN cd /data/deploy/ && tar zxf StarRocks-2.3.3.tar.gz

# Install Java JDK.
COPY jdk-8u202-linux-x64.tar.gz /opt/
RUN cd /opt/ && tar xf jdk-8u202-linux-x64.tar.gz
RUN /opt/jdk1.8.0_202/bin/java -version

# Create directory for FE meta and BE storage in StarRocks.
RUN mkdir -p /data/deploy/StarRocks-2.3.3/fe/meta
RUN mkdir -p /data/deploy/StarRocks-2.3.3/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

准备启动脚本如下:

代码语言:javascript复制
$ cat run_script.sh
#!/bin/bash


# Set JAVA_HOME.
export JAVA_HOME=/opt/jdk1.8.0_202/

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

sleep 30;

# Start BE.
cd /data/deploy/StarRocks-2.3.3/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 true; do
  ps aux | grep starrocks | grep -q -v grep
  PROCESS_STATUS=$?
done

打包

代码语言:javascript复制
docker build --no-cache --progress=plain -t starrocks:1.0 .

启动

代码语言:javascript复制
docker run -p 9030:9030 -p 8030:8030 -p 8040:8040 --privileged=true -itd --name starrocks-test starrocks:1.0

连接starrocks

代码语言:javascript复制
mysql -uroot -h127.0.0.1 -P 9030

[(none)]> SHOW PROC '/backends'G
*************************** 1. row ***************************
            BackendId: 10002
              Cluster: default_cluster
                   IP: 172.17.0.2
        HeartbeatPort: 9050
               BePort: 9060
             HttpPort: 8040
             BrpcPort: 8060
        LastStartTime: 2022-11-07 04:40:38
        LastHeartbeat: 2022-11-07 05:34:25
                Alive: true
 SystemDecommissioned: false
ClusterDecommissioned: false
            TabletNum: 10
     DataUsedCapacity: .000 
        AvailCapacity: 37.899 GB
        TotalCapacity: 294.971 GB
              UsedPct: 87.15 %
       MaxDiskUsedPct: 87.15 %
               ErrMsg: 
              Version: 2.3.3-164799c
               Status: {"lastSuccessReportTabletsTime":"2022-11-07 05:33:39"}
    DataTotalCapacity: 37.899 GB
          DataUsedPct: 0.00 %
             CpuCores: 8
1 row in set (0.00 sec)

[(none)]> SHOW PROC '/frontends'G
*************************** 1. row ***************************
             Name: 172.17.0.2_9010_1667795978250
               IP: 172.17.0.2
      EditLogPort: 9010
         HttpPort: 8030
        QueryPort: 9030
          RpcPort: 9020
             Role: FOLLOWER
         IsMaster: true
        ClusterId: 1090400975
             Join: true
            Alive: true
ReplayedJournalId: 990
    LastHeartbeat: 2022-11-07 05:34:25
         IsHelper: true
           ErrMsg: 
        StartTime: 2022-11-07 04:39:50
          Version: 2.3.3-164799c
1 row in set (0.02 sec)

0 人点赞