Quickstart StarRocks on Mac laptop

Contents

Docker pull Centos

Prepare StarRocks tar bales

Initiate a docker container

Fix Java JDK

Deploy StarRocks-CE-2.0.1

TEST


Docker pull Centos

  • Install Docker on mac, refer to https://www.docker.com/get-started
  • Pull Centos images as below:
(Zsh)simon@MBp16:~ %>docker pull centos:centos7                                                                                                                                                                                  
centos7: Pulling from library/centos
Digest: sha256:9d4bcbbb213dfd745b58be38b13b996ebb5ac315fe75711bd618426a630e0987
Status: Image is up to date for centos:centos7
docker.io/library/centos:centos7

Prepare StarRocks tar bales

(Zsh)simon@MBp16:~/private/repo/SR %>wget -SO StarRocks-2.0.1.tar.gz https://starrocks.com/en-US/download/request-download/12

(Zsh)simon@MBp16:~/private/repo/SR %>mkdir deploy                                                                                                                                                                              
(Zsh)simon@MBp16:~/private/repo/SR %>tar zxf StarRocks-2.0.1.tar.gz -C deploy

(Zsh)simon@MBp16:~/private/repo/SR %>pwd                                                                                                                                                                                          
/Users/simon/private/repo/SR

Initiate a docker container

(Zsh)simon@MBp16:~/private/repo/SR %>docker run -p 9030:9030 -p 8030:8030 -p 8040:8040  -v /Users/simon/private/repo/SR:/data --privileged=true   -itd --name centos-test centos:centos7                                          
b806e54486b0f76619d5b01e314d3ef59da05fb1980431adfffa4b4ff6407194
(Zsh)simon@MBp16:~/private/repo/SR %>docker ps                                                                                                                                                                                    
CONTAINER ID   IMAGE            COMMAND       CREATED          STATUS          PORTS                                                                                                                             NAMES
b806e54486b0   centos:centos7   "/bin/bash"   11 seconds ago   Up 10 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   centos-test
(Zsh)simon@MBp16:~/private/repo/SR %>


(Zsh)simon@MBp16:~/private/repo/SR %>docker exec -ti b8 bash 
[root@b806e54486b0 /]# cd /data/deploy/StarRocks-2.0.1/
[root@b806e54486b0 StarRocks-2.0.1]# ls
LICENSE.txt  NOTICE.txt  apache_hdfs_broker  be  fe  udf

Fix Java JDK

  • Note: yum installation is not necessary, you can also prepare jdk dist under your native Storage Volume and manually provision jdk environment.
[root@b806e54486b0 bin]# ./start_fe.sh --daemon
Error: JAVA_HOME is not set.


[root@b806e54486b0 bin]# yum -y install java-1.8.0-openjdk-devel.x86_64
[root@b806e54486b0 bin]# rpm -ql  java-1.8.0-openjdk-devel.x86_64 | grep bin$
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/bin

[root@b806e54486b0 bin]# /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/bin/java -version
openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)

[root@b806e54486b0 bin]# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64

Deploy StarRocks-CE-2.0.1

[root@b806e54486b0 log]# cd /data/deploy/StarRocks-2.0.1/fe/
[root@b806e54486b0 fe]# mkdir -p meta
[root@b806e54486b0 fe]# cd bin/
[root@b806e54486b0 bin]# ./start_fe.sh --daemon
[root@b806e54486b0 bin]# jps
3713 Jps
3690 StarRocksFE

[root@b806e54486b0 be]# pwd
/data/deploy/StarRocks-2.0.1/be
[root@b806e54486b0 be]# mkdir -p storage
[root@b806e54486b0 be]# cd bin/
[root@b806e54486b0 bin]# ./start_be.sh --daemon
[root@b806e54486b0 bin]#

[root@b806e54486b0 bin]# ps aux |grep be |grep starrocks -i
root      2874  1.2  0.5 2865524 77336 pts/1   Sl   11:22   0:00 /data/deploy/StarRocks-2.0.1/be/lib/starrocks_be
  • NOTE: Connect to your StarRocks using a mysql-client or alternative tools like DBever, Navicat, Zepplin etc.
(Zsh)simon@MBp16:~ %>mysql -uroot -h127.0.0.1 -P 9030
mysql> show frontends\G
*************************** 1. row ***************************
             Name: 172.17.0.2_9010_1643196291015
               IP: 172.17.0.2
      EditLogPort: 9010
         HttpPort: 8030
        QueryPort: 9030
          RpcPort: 9020
             Role: FOLLOWER
         IsMaster: true
        ClusterId: 1909402098
             Join: true
            Alive: true
ReplayedJournalId: 13
    LastHeartbeat: 2022-01-26 11:25:32
         IsHelper: true
           ErrMsg:
        StartTime: 2022-01-26 11:25:03
          Version: 2.0.1-f0de9ec
1 row in set (0.01 sec)
mysql> alter system add backend '172.17.0.2:9050';
Query OK, 0 rows affected (0.02 sec)
mysql> show backends\G
*************************** 1. row ***************************
            BackendId: 10002
              Cluster: default_cluster
                   IP: 172.17.0.2
        HeartbeatPort: 9050
               BePort: 9060
             HttpPort: 8040
             BrpcPort: 8060
        LastStartTime: 2022-01-26 11:27:02
        LastHeartbeat: 2022-01-26 11:27:02
                Alive: true
 SystemDecommissioned: false
ClusterDecommissioned: false
            TabletNum: 0
     DataUsedCapacity: .000
        AvailCapacity: 16.960 GB
        TotalCapacity: 465.725 GB
              UsedPct: 96.36 %
       MaxDiskUsedPct: 96.36 %
               ErrMsg:
              Version: 2.0.1-f0de9ec
               Status: {"lastSuccessReportTabletsTime":"2022-01-26 11:27:02"}
    DataTotalCapacity: 16.960 GB
          DataUsedPct: 0.00 %
1 row in set (0.01 sec)

TEST

  • Note: replication =1 since we only play around single node
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'  ;
mysql> select * from sr_on_mac  where c1 >= '2022-02-02'  ;
+------+------------+---------------------+------+
| c0   | c1         | c2                  | c3   |
+------+------------+---------------------+------+
|    3 | 2022-02-03 | 2022-02-03 10:47:57 | 333  |
|    2 | 2022-02-02 | 2022-02-02 10:47:57 | 222  |
+------+------------+---------------------+------+
2 rows in set (0.35 sec)

StarRocks招聘:

招解决方案,DBA,数据库研发,测试,前后端开发等岗位,

有意者请投递简历到 hr@starrocks.com

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值