| --- |
| { |
| "title": "Quick Start | GettingStarted", |
| "language": "en", |
| "description": "Starting from Doris version 2.1.8, Docker can be used for rapid deployment.", |
| "sidebar_label": "Quick Start" |
| } |
| --- |
| |
| # Quick Start |
| |
| :::caution Warning: |
| |
| 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: |
| |
| 1. **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. |
| |
| 2. **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: Download the Quick-Start script |
| |
| <a target="_blank" download rel="noopener noreferrer" href="/files/start-doris.sh"> Download the script </a>, run the following command to grant it the corresponding execution permissions. |
| |
| ```shell |
| chmod 755 start-doris.sh |
| ``` |
| |
| ### Step 2: Start the cluster |
| |
| Run the script to start the cluster, using the `4.0.1` version by default |
| |
| ```shell |
| bash start-doris.sh |
| ``` |
| |
| You can specify the startup version through the -v parameter, such as: |
| |
| ```shell |
| bash start-doris.sh -v 2.1.8 |
| ``` |
| |
| ### Step 3: Connect to the cluster using MySQL client and check the cluster status |
| |
| ```sql |
| ## 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 |
| |
| :::info Environment Recommendations: |
| |
| * **Operating System**: It is recommended to use AMD/ARM mainstream Linux environments such as Ubuntu and above. |
| |
| * **Java Environment**: It is advised to use the Java 17 runtime environment. |
| |
| * **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](https://doris.apache.org/download), and extract it. |
| |
| ### Step 2: Modify the Environment Variables |
| |
| 1. **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: |
| |
| ```sql |
| vi /etc/security/limits.conf |
| * soft nofile 1000000 |
| * hard nofile 1000000 |
| ``` |
| |
| 2. **Modify Virtual Memory Area** |
| |
| Use the following command to permanently modify the virtual memory area to at least 2000000, and apply the change immediately: |
| |
| ```bash |
| cat >> /etc/sysctl.conf << EOF |
| vm.max_map_count = 2000000 |
| EOF |
| |
| ## Take effect immediately |
| sysctl -p |
| ``` |
| |
| ### Step 3: Install FE |
| |
| 1. **Configure FE** |
| |
| Modify the following contents in the FE configuration file `apache-doris/fe/conf/fe.conf`: |
| |
| ```sql |
| ## Specify Java environment |
| JAVA_HOME=/home/doris/jdk |
| |
| ## Specify the CIDR block for FE listening IP |
| priority_networks=127.0.0.1/32 |
| ``` |
| |
| 2. **Start FE** |
| |
| Run the FE process by executing the `start_fe.sh` script: |
| |
| ```sql |
| apache-doris/fe/bin/start_fe.sh --daemon |
| ``` |
| |
| 3. **Check FE Status** |
| |
| Connect to the cluster using MySQL client and check the cluster status: |
| |
| ```sql |
| ## 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 |
| |
| 1. **Configure BE** |
| |
| Modify the following contents in the BE configuration file `apache-doris/be/conf/be.conf`: |
| |
| ```sql |
| ## Specify Java environment |
| JAVA_HOME=/home/doris/jdk |
| |
| ## Specify the CIDR block for BE's listening IP |
| priority_networks=127.0.0.1/32 |
| ``` |
| |
| 2. **Start BE** |
| |
| Start the BE process with the following command: |
| |
| ```sql |
| apache-doris/be/bin/start_be.sh --daemon |
| ``` |
| |
| 3. **Register BE Node in the Cluster** |
| |
| Connect to the cluster using MySQL client: |
| |
| ```sql |
| mysql -uroot -P9030 -h127.0.0.1 |
| ``` |
| |
| Use the ADD BACKEND command to register the BE node: |
| |
| ```sql |
| ALTER SYSTEM ADD BACKEND "127.0.0.1:9050"; |
| ``` |
| |
| 4. **Check BE Status** |
| |
| Connect to the cluster using MySQL client and check the cluster status: |
| |
| ```sql |
| ## 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 |
| |
| 1. **Connect to the cluster using MySQL client:** |
| |
| ```sql |
| mysql -uroot -P9030 -h127.0.0.1 |
| ``` |
| |
| 2. **Create database and test table:** |
| |
| ```sql |
| 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; |
| ``` |
| |
| 3. **Import test data:** |
| |
| Insert test data using the Insert Into statement |
| |
| ```sql |
| insert into mytable values |
| (1,0.14,'a1',20), |
| (2,1.04,'b2',21), |
| (3,3.14,'c3',22), |
| (4,4.35,'d4',23); |
| ``` |
| |
| 4. **Execute the following SQL query in the MySQL client to view the imported data:** |
| |
| ```sql |
| 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) |
| ``` |
| |
| ## FAQs |
| |
| **Q: How do I install Docker on Mac?** |
| |
| A: Download and install [Docker Desktop](https://www.docker.com/products/docker-desktop/). |
| |
| **Q: Mac: "Error: Docker environment not detected" after Docker Desktop is installed** |
| |
| A: Create a symlink: |
| |
| ```shell |
| sudo ln -s /Applications/Docker.app/Contents/Resources/bin/docker /usr/local/bin/docker |
| ``` |
| |
| **Q: Mac: "error getting credentials - err: exit status 1, out: \`\`"** |
| |
| A: This error is usually caused by Docker credential helper misconfiguration. For local development/testing, you can remove the `credsStore` field in `~/.docker/config.json` as a workaround. Note: This workaround stores credentials in plaintext and is only recommended for local development environments. |
| |
| |