软件下载:https://apache-doris-releases.oss-accelerate.aliyuncs.com/apache-doris-2.1.7-bin-x64.tar.gz
安装配置jdk环境:
tar -zxvf jdk-8u202-linux-x64.tar.gz -C /usr/local/ tee -a /etc/profile <<EOF export JAVA_HOME=/usr/local/jdk1.8.0_202 export PATH=\$PATH:\$JAVA_HOME/bin EOF
source /etc/profile
java -version
解压doris软件:
tar -zxvf apache-doris-2.1.7-bin-x64.tar.gz -C /usr/local/
关闭swap和修改limits.conf
tee -a /etc/security/limits.conf <<EOF * soft nofile 65536 * hard nofile 65536 EOF
sysctl -p swapoff -a
sudo sed -i '/swap/s/^/#/' /etc/fstab
启动FE
[root@node1 fe]# ./bin/start_fe.sh --daemon [root@node1 fe]# ps -ef | grep fe root 66 2 0 Nov14 ? 00:00:00 [deferwq] root 6659 1 99 01:05 pts/0 00:00:10 /usr/local/jdk1.8.0_202/bin/java -Dfile.encoding=UTF-8 -Djavax.security.auth.useSubjectCredsOnly=false -Xss4m -Xmx8192m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:/usr/local/apache-doris-2.1.7-bin-x64/fe/log/fe.gc.log.20241115-010527 -Dlog4j2.formatMsgNoLookups=true -XX:-OmitStackTraceInFastThrow -XX:OnOutOfMemoryError=kill -9 %p org.apache.doris.DorisFE root 6867 2388 0 01:05 pts/0 00:00:00 grep --color=auto fe [root@node1 fe]#
启动BE
[root@node1 be]# ./bin/start_be.sh --daemon Set max number of open file descriptors to a value greater than 60000. Ask your system manager to modify /etc/security/limits.conf and append content like * soft nofile 655350 * hard nofile 655350 and then run 'ulimit -n 655350' to take effect on current session. [root@node1 be]# ulimit -n 655350 [root@node1 be]# [root@node1 be]# ./bin/start_be.sh --daemon [root@node1 be]#
连接FE需要使用mysql5.7客户端,只需要mysql客户端命令。
[root@node1 be]# mysql -uroot -P9030 -h127.0.0.1 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 0 Server version: 5.7.99 Copyright (c) 2000, 2022, Oracle and/or its affiliates. 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. ['root'@127.0.0.1][(none)]>
注册BE到FE中
['root'@127.0.0.1][(none)]> ALTER SYSTEM ADD BACKEND "10.43.20.102:9050"; Query OK, 0 rows affected (0.09 sec) ['root'@127.0.0.1][(none)]>
查看BE,FE状态
['root'@127.0.0.1][(none)]> show proc '/frontends'; +-----------------------------------------+--------------+-------------+----------+-----------+---------+--------------------+----------+----------+------------+------+-------+-------------------+---------------------+---------------------+----------+--------+-----------------------------+------------------+ | Name | Host | EditLogPort | HttpPort | QueryPort | RpcPort | ArrowFlightSqlPort | Role | IsMaster | ClusterId | Join | Alive | ReplayedJournalId | LastStartTime | LastHeartbeat | IsHelper | ErrMsg | Version | CurrentConnected | +-----------------------------------------+--------------+-------------+----------+-----------+---------+--------------------+----------+----------+------------+------+-------+-------------------+---------------------+---------------------+----------+--------+-----------------------------+------------------+ | fe_7dde06d2_96d7_4bcc_8c23_1d47da963ec1 | 10.43.20.102 | 9010 | 8030 | 9030 | 9020 | -1 | FOLLOWER | true | 1292288095 | true | true | 129 | 2024-11-15 01:05:34 | 2024-11-15 01:13:15 | true | | doris-2.1.7-rc03-443e87e203 | Yes | +-----------------------------------------+--------------+-------------+----------+-----------+---------+--------------------+----------+----------+------------+------+-------+-------------------+---------------------+---------------------+----------+--------+-----------------------------+------------------+ 1 row in set (0.14 sec) ['root'@127.0.0.1][(none)]> show proc '/backends'; +-----------+--------------+---------------+--------+----------+----------+--------------------+---------------------+---------------------+-------+----------------------+-----------+------------------+-------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+ | BackendId | Host | HeartbeatPort | BePort | HttpPort | BrpcPort | ArrowFlightSqlPort | LastStartTime | LastHeartbeat | Alive | SystemDecommissioned | TabletNum | DataUsedCapacity | TrashUsedCapacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | RemoteUsedCapacity | Tag | ErrMsg | Version | Status | HeartbeatFailureCounter | NodeRole | +-----------+--------------+---------------+--------+----------+----------+--------------------+---------------------+---------------------+-------+----------------------+-----------+------------------+-------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+ | 11072 | 10.43.20.102 | 9050 | 9060 | 8040 | 8060 | -1 | 2024-11-15 01:07:15 | 2024-11-15 01:13:35 | true | false | 22 | 0.000 | 0.000 | 29.980 GB | 45.775 GB | 34.51 % | 34.51 % | 0.000 | {"location" : "default"} | | doris-2.1.7-rc03-443e87e203 | {"lastSuccessReportTabletsTime":"2024-11-15 01:12:52","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0 | mix | +-----------+--------------+---------------+--------+----------+----------+--------------------+---------------------+---------------------+-------+----------------------+-----------+------------------+-------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+ 1 row in set (0.00 sec)
搭建完成,修改连接密码:
['root'@127.0.0.1][(none)]> SET PASSWORD FOR 'root' = PASSWORD('doris-root-password'); Query OK, 0 rows affected (0.03 sec) ['root'@127.0.0.1][(none)]> SET PASSWORD FOR 'admin' = PASSWORD('doris-admin-password'); Query OK, 0 rows affected (0.00 sec)
创建数据库和表信息:
使用admin用户连接
[root@node1 be]# mysql -uadmin -P9030 -h127.0.0.1 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.7.99 Doris version doris-2.1.7-rc03-443e87e203 Copyright (c) 2000, 2022, Oracle and/or its affiliates. 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. ['admin'@127.0.0.1][(none)]> create database demo; k3 CHAR(10) COMMENT "string column", k4 INT NOT NULL DEFAULT "1" COMMENT "int column" ) COMMENT "my first table" DISTRIBUTED BY HASH(k1) BUCKETS 1 PROPERTIES ('replication_num' = '1');Query OK, 0 rows affected (0.01 sec) ['admin'@127.0.0.1][(none)]> ['admin'@127.0.0.1][(none)]> use demo; Database changed ['admin'@127.0.0.1][demo]> create table mytable -> ( -> k1 TINYINT, -> k2 DECIMAL(10, 2) DEFAULT "10.05", -> k3 CHAR(10) COMMENT "string column", -> k4 INT NOT NULL DEFAULT "1" COMMENT "int column" -> ) -> COMMENT "my first table" -> DISTRIBUTED BY HASH(k1) BUCKETS 1 -> PROPERTIES ('replication_num' = '1'); Query OK, 0 rows affected (0.02 sec)
创建语句:
create database demo;
use demo;
create table mytable ( k1 TINYINT, k2 DECIMAL(10, 2) DEFAULT "10.05", k3 CHAR(10) COMMENT "string column", k4 INT NOT NULL DEFAULT "1" COMMENT "int column" ) COMMENT "my first table" DISTRIBUTED BY HASH(k1) BUCKETS 1 PROPERTIES ('replication_num' = '1');
构造导入数据
tee -a data.csv <<EOF 1,0.14,a1,20 2,1.04,b2,21 3,3.14,c3,22 4,4.35,d4,23 EOF
导入数据成功:
[root@node1 be]# curl --location-trusted -u admin:doris-admin-password -T data.csv -H "column_separator:," http://127.0.0.1:8030/api/demo/mytable/_stream_load { "TxnId": 3, "Label": "508a19a6-d202-468e-a24e-8cc63a6e4891", "Comment": "", "TwoPhaseCommit": "false", "Status": "Success", "Message": "OK", "NumberTotalRows": 4, "NumberLoadedRows": 4, "NumberFilteredRows": 0, "NumberUnselectedRows": 0, "LoadBytes": 52, "LoadTimeMs": 463, "BeginTxnTimeMs": 37, "StreamLoadPutTimeMs": 302, "ReadDataTimeMs": 0, "WriteDataTimeMs": 74, "ReceiveDataTimeMs": 344, "CommitAndPublishTimeMs": 46 } [root@node1 be]#
参考连接:https://doris.apache.org/docs/gettingStarted/quick-start/
标签:none,127.0,0.1,node1,Apache,2.1,root,doris From: https://www.cnblogs.com/elanjie/p/18546446