Skip to content

Commit 562a473

Browse files
authored
Doc: Add QuikStart (#1829)
* quikstart * Update index.md * Update index.md * fix typo * refine * refine
1 parent 415b434 commit 562a473

File tree

1 file changed

+143
-0
lines changed
  • docs/en/guides/10-deploy/00-QuickStart

1 file changed

+143
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
title: QuickStart
3+
---
4+
5+
Databend Quick Start: Experience Databend in 5 Minutes
6+
This guide will help you quickly set up Databend, connect to it, and perform a basic data import.
7+
8+
## 1. Start Databend with Docker
9+
Run the following command to launch Databend in a container:
10+
11+
```
12+
docker run -d \
13+
--name databend \
14+
--network host \
15+
-e MINIO_ENABLED=true \
16+
-e QUERY_DEFAULT_USER=databend \
17+
-e QUERY_DEFAULT_PASSWORD=databend \
18+
-v minio_data_dir:/var/lib/minio \
19+
--restart unless-stopped \
20+
datafuselabs/databend
21+
```
22+
Check if Databend is running successfully:
23+
24+
```
25+
docker logs -f databend
26+
```
27+
Wait until you see logs indicating that Databend and MinIO are ready.
28+
29+
## 2. Connect to Databend
30+
Install bendsql (Databend CLI):
31+
32+
```
33+
curl -fsSL https://repo.databend.com/install/bendsql.sh | bash
34+
echo "export PATH=$PATH:~/.bendsql/bin" >>~/.bash_profile
35+
source ~/.bash_profile
36+
```
37+
38+
Connect to Databend:
39+
```
40+
bendsql -udatabend -pdatabend
41+
```
42+
43+
## 3. Perform a Basic Data Import
44+
### Step 1: Create an External Bucket (myupload)
45+
Install mc (MinIO client) and create a bucket:
46+
47+
```
48+
wget https://dl.min.io/client/mc/release/linux-amd64/mc
49+
sudo cp mc /usr/local/bin/ && sudo chmod +x /usr/local/bin/mc
50+
mc alias set myminio http://localhost:9000 minioadmin minioadmin
51+
mc mb myminio/myupload
52+
mc ls myminio
53+
```
54+
Expected output:
55+
```
56+
[0001-01-01 08:05:43 LMT] 0B databend/
57+
[2025-04-12 08:43:59 CST] 0B myupload/
58+
```
59+
60+
### Step 2: Generate a CSV and Upload to myupload
61+
```
62+
echo -e "id,name,age,city\n1,John,32,New York\n2,Emma,28,London\n3,Liam,35,Paris\n4,Olivia,40,Berlin\n5,Noah,29,Tokyo" > data.csv
63+
mc cp data.csv myminio/myupload/
64+
mc ls myminio/myupload/
65+
```
66+
### Step 3: Create an External Stage and Check Data
67+
Run in bendsql:
68+
```
69+
CREATE STAGE mystage 's3://myupload'
70+
CONNECTION=(
71+
endpoint_url='http://127.0.0.1:9000',
72+
access_key_id='minioadmin',
73+
secret_access_key='minioadmin',
74+
region='us-east-1'
75+
);
76+
```
77+
Show files in the external stage @mystage:
78+
```
79+
LIST @mystage;
80+
```
81+
| name | size | md5 | last_modified | creator |
82+
|----------|--------|-------------------|-----------------------|-------------|
83+
| String | UInt64 | Nullable(String) | String | Nullable(String) |
84+
| data.csv | 104 | "a27fa15258911f534fb795a8c64e05d4" | 2025-04-12 00:51:11.015 +0000 | NULL |
85+
86+
Preview the CSV data:
87+
```
88+
SELECT $1, $2, $3, $4 FROM @mystage/data.csv (FILE_FORMAT=>'CSV') LIMIT 10;
89+
```
90+
| \$1 | \$2 | \$3 | \$4 |
91+
|-------------------|-------------------|-------------------|-------------------|
92+
| Nullable(String) | Nullable(String) | Nullable(String) | Nullable(String) |
93+
| id | name | age | city |
94+
| 1 | John | 32 | New York |
95+
| 2 | Emma | 28 | London |
96+
| 3 | Liam | 35 | Paris |
97+
| 4 | Olivia | 40 | Berlin |
98+
| 5 | Noah | 29 | Tokyo |
99+
100+
101+
### Step 4: Create a Table and Load Data
102+
```
103+
CREATE DATABASE wubx;
104+
USE wubx;
105+
106+
CREATE TABLE t_person (
107+
id INT,
108+
name VARCHAR,
109+
age INT UNSIGNED,
110+
city VARCHAR
111+
);
112+
113+
COPY INTO t_person FROM @mystage PATTERN='.*[.]csv' FILE_FORMAT=(TYPE=CSV, SKIP_HEADER=1);
114+
115+
```
116+
117+
| File | Rows_loaded | Errors_seen | First_error | First_error_line |
118+
|-----------|-------------|-------------|------------------|------------------|
119+
| String | Int32 | Int32 | Nullable(String) | Nullable(Int32) |
120+
| data.csv | 5 | 0 | NULL | NULL |
121+
122+
### Step 5: Query the Data
123+
```
124+
SELECT * FROM t_person;
125+
```
126+
| id | name | age | city |
127+
|----------|----------|----------|----------|
128+
| Nullable(Int32) | Nullable(String) | Nullable(UInt32) | Nullable(String) |
129+
| 1 | John | 32 | New York |
130+
| 2 | Emma | 28 | London |
131+
| 3 | Liam | 35 | Paris |
132+
| 4 | Olivia | 40 | Berlin |
133+
| 5 | Noah | 29 | Tokyo |
134+
135+
🚀 Now you’ve successfully imported data into Databend!
136+
137+
## Alternative: Databend Cloud
138+
If setting up a local environment is troublesome, you can try [Databend Cloud](https://www.databend.com) for a fully managed experience.
139+
140+
141+
> 💬 **Community Support**
142+
> Have questions? Connect with our team:
143+
> 💬 [Slack Discussion](https://link.databend.com/join-slack)

0 commit comments

Comments
 (0)