Quick Start
The following rapid deployment methods are intended solely for local development and testing, and should not be used in production environments. The reasons are as follows:
-
Data Vulnerability: Data can be easily lost when using Docker deployment, as data is lost upon container destruction. Manual deployment of single-replica instances lacks data redundancy and backup capabilities, meaning machine failures could result in data loss.
-
Single-Replica Configuration: The table creation statements in the examples are all single-replica. In a production environment, multi-replica storage should be used to ensure data reliability.
Use Docker for Quick Deploymentβ
Starting from Doris version 2.1.8, Docker can be used for rapid deployment.
Step 1: Create the docker-compose.yaml Fileβ
Copy the following content into the docker-compose.yaml file, and replace the DORIS_QUICK_START_VERSION
parameter with the specified version, such as 3.0.1
.
version: "3"
services:
fe:
image: apache/doris.fe-ubuntu:${DORIS_QUICK_START_VERSION}
hostname: fe
environment:
- FE_SERVERS=fe1:127.0.0.1:9010
- FE_ID=1
network_mode: host
be:
image: apache/doris.be-ubuntu:${DORIS_QUICK_START_VERSION}
hostname: be
environment:
- FE_SERVERS=fe1:127.0.0.1:9010
- BE_ADDR=127.0.0.1:9050
depends_on:
- fe
network_mode: host
Step 2: Start Clusterβ
Start the cluster using the docker-compose command.
docker-compose -f ./docker-compose.yaml up -d
Step 3: Connect to the cluster using MySQL client and check the cluster statusβ
## Check the FE status to ensure that both the Join and Alive columns are true.
mysql -uroot -P9030 -h127.0.0.1 -e 'SELECT `host`, `join`, `alive` FROM frontends()'
+-----------+------+-------+
| host | join | alive |
+-----------+------+-------+
| 127.0.0.1 | true | true |
+-----------+------+-------+
## Check the BE status to ensure that the Alive column is true.
mysql -uroot -P9030 -h127.0.0.1 -e 'SELECT `host`, `alive` FROM backends()'
+-----------+-------+
| host | alive |
+-----------+-------+
| 127.0.0.1 | 1 |
+-----------+-------+
Local Quick Deploymentβ
-
Operating System: It is recommended to use AMD/ARM mainstream Linux environments such as CentOS 7.1 or Ubuntu 16.04 and above.
-
Java Environment: It is advised to use the Java 8 runtime environment. For non-Oracle JDK commercial license users, please use the free Oracle JDK 8u300 or later versions.
-
User Permissions: It is recommended to create a new Doris user on Linux and avoid using the root user for operations.
Step 1: Download the Binary Packageβ
Download the corresponding binary installation package from the Apache Doris website here, and extract it.
Step 2: Modify the Environment Variablesβ
-
Modify the system's maximum open file descriptor limit
Use the following command to adjust the maximum file descriptor limit. After making this change, you need to restart the session to apply the configuration:
vi /etc/security/limits.conf
* soft nofile 1000000
* hard nofile 1000000 -
Modify Virtual Memory Area
Use the following command to permanently modify the virtual memory area to at least 2000000, and apply the change immediately:
cat >> /etc/sysctl.conf << EOF
vm.max_map_count = 2000000
EOF
## Take effect immediately
sysctl -p
Step 3: Install FEβ
-
Configure FE
Modify the following contents in the FE configuration file
apache-doris/fe/conf/fe.conf
:## Specify Java environment
JAVA_HOME=/home/doris/jdk
## Specify the CIDR block for FE listening IP
priority_networks=127.0.0.1/32 -
Start FE
Run the FE process by executing the
start_fe.sh
script:apache-doris/fe/bin/start_fe.sh --daemon
-
Check FE Status
Connect to the cluster using MySQL client and check the cluster status:
## Check FE Status to ensure that both the Join and Alive columns are true
mysql -uroot -P9030 -h127.0.0.1 -e "show frontends;"
+-----------------------------------------+-----------+-------------+----------+-----------+---------+----------+----------+-----------+------+-------+-------------------+---------------------+----------+--------+-------------------------+------------------+
| Name | Host | EditLogPort | HttpPort | QueryPort | RpcPort | Role | IsMaster | ClusterId | Join | Alive | ReplayedJournalId | LastHeartbeat | IsHelper | ErrMsg | Version | CurrentConnected |
+-----------------------------------------+-----------+-------------+----------+-----------+---------+----------+----------+-----------+------+-------+-------------------+---------------------+----------+--------+-------------------------+------------------+
| fe_9d0169c5_b01f_478c_96ab_7c4e8602ec57 | 127.0.0.1 | 9010 | 8030 | 9030 | 9020 | FOLLOWER | true | 656872880 | true | true | 276 | 2024-07-28 18:07:39 | true | | doris-2.0.12-2971efd194 | Yes |
+-----------------------------------------+-----------+-------------+----------+-----------+---------+----------+----------+-----------+------+-------+-------------------+---------------------+----------+--------+-------------------------+------------------+
Step 4: Install BEβ
-
Configure BE
Modify the following contents in the BE configuration file
apache-doris/be/conf/be.conf
:## Specify Java environment
JAVA_HOME=/home/doris/jdk
## Specify the CIDR block for BE's listening IP
priority_networks=127.0.0.1/32 -
Start BE
Start the BE process with the following command:
apache-doris/be/bin/start_be.sh --daemon
-
Register BE Node in the Cluster
Connect to the cluster using MySQL client:
mysql -uroot -P9030 -h127.0.0.1
Use the ADD BACKEND command to register the BE node:
ALTER SYSTEM ADD BACKEND "127.0.0.1:9050";
-
Check BE Status
Connect to the cluster using MySQL client and check the cluster status:
## Check BE Status to ensure that the Alive column is true
mysql -uroot -P9030 -h127.0.0.1 -e "show backends;"
+-----------+-----------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------+------------------+--------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+-------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| BackendId | Host | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime | LastHeartbeat | Alive | SystemDecommissioned | TabletNum | DataUsedCapacity | TrashUsedCapcacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | RemoteUsedCapacity | Tag | ErrMsg | Version | Status | HeartbeatFailureCounter | NodeRole |
+-----------+-----------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------+------------------+--------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+-------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| 10156 | 127.0.0.1 | 9050 | 9060 | 8040 | 8060 | 2024-07-28 17:59:14 | 2024-07-28 18:08:24 | true | false | 14 | 0.000 | 0.000 | 8.342 GB | 19.560 GB | 57.35 % | 57.35 % | 0.000 | {"location" : "default"} | | doris-2.0.12-2971efd194 | {"lastSuccessReportTabletsTime":"2024-07-28 18:08:14","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0 | mix |
+-----------+-----------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------+------------------+--------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+-------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
Run Queriesβ
-
Connect to the cluster using MySQL client:
mysql -uroot -P9030 -h127.0.0.1
-
Create database and test table:
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; -
Import test data:
Insert test data using the Insert Into statement
insert into mytable values
(1,0.14,'a1',20),
(2,1.04,'b2',21),
(3,3.14,'c3',22),
(4,4.35,'d4',23); -
Execute the following SQL query in the MySQL client to view the imported data:
MySQL [demo]> select * from demo.mytable;
+------+------+------+------+
| k1 | k2 | k3 | k4 |
+------+------+------+------+
| 1 | 0.14 | a1 | 20 |
| 2 | 1.04 | b2 | 21 |
| 3 | 3.14 | c3 | 22 |
| 4 | 4.35 | d4 | 23 |
+------+------+------+------+
4 rows in set (0.10 sec)