Skip to content

Commit

Permalink
Merge pull request #303 from ByteStorage/cloud-feature
Browse files Browse the repository at this point in the history
Cloud feature
  • Loading branch information
sjcsjc123 authored Jan 23, 2024
2 parents 32fb125 + 1a84cea commit 4a36750
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build-image:
@echo "Building docker image..."
hack/build-docker-image.sh
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ git clone https://github.com/ByteStorage/FlyDB.git

## 🖥 How to use FlyDB ?

### Used by Golang SDK

Here is a simple example of how to use the Linux version:

> See flydb/examples for details.
Expand Down Expand Up @@ -65,12 +67,34 @@ func main() {
}
}
```
>You can also run this command.
### Used By Shell Command

```shell
./build.sh
```

### Used By Docker

```shell
docker run -d --name flydb-server --network=host -p 8999:8999 bytestorage/flydb:v1.0
```

### Used By Kubernetes

```shell
kubectl apply -f kubernetes/flydb-namespace.yaml
kubectl apply -f kubernetes/flydb-deployment.yaml
kubectl apply -f kubernetes/flydb-service.yaml
kubectl wait --for=condition=ready pod -l app=flydb -n flydb-system
kubectl port-forward svc/flydb-service -n flydb-system 8999:8999
```

**When install flydb server by shell/docker/kubernetes, you can use the flydb-cli to connect the flydb server.**

```shell
./bin/flydb-client 127.0.0.1:8999"
```
## 🚀 Performance test
We did a simple performance test of the V1.0.4 version of FlyDB. This test mainly focused on reading and writing large-scale data, and we selected 500,000 random data for testing.
Expand Down
29 changes: 28 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ git clone https://github.com/ByteStorage/FlyDB

## 🚀 如何使用 FlyDB ?

### 使用Golang SDK

下面是一个如何使用Linux版本的简单示例:

> 详情请参阅 flydb/examples。
Expand Down Expand Up @@ -66,10 +68,35 @@ func main() {


```
>你也可以执行以下命令。

### 使用Shell命令

```shell
./build.sh
```

### 使用Docker

```shell
docker run -d --name flydb-server --network=host -p 8999:8999 bytestorage/flydb:v1.0
```

### 使用Kubernetes

```shell
kubectl apply -f kubernetes/flydb-namespace.yaml
kubectl apply -f kubernetes/flydb-deployment.yaml
kubectl apply -f kubernetes/flydb-service.yaml
kubectl wait --for=condition=ready pod -l app=flydb -n flydb-system
kubectl port-forward svc/flydb-service -n flydb-system 8999:8999
```

**当通过shell/docker/kubernets启动FlyDB时,可使用flydb-client连接FlyDB服务器。**

```shell
./bin/flydb-client 127.0.0.1:8999"
```
## 🚀 性能测试
我们对V1.0.4版本的FlyDB做了一个简单的性能测试。本次测试主要针对大规模数据的读写,我们随机选取了50万条数据进行测试。
Expand Down
9 changes: 9 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:18.04

WORKDIR /app

COPY bin/flydb-server /app/flydb-server

RUN chmod +x /app/flydb-server

CMD ["/app/flydb-server"]
31 changes: 31 additions & 0 deletions hack/build-docker-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

DOCKER_USERNAME="${DOCKER_USERNAME:-bytestorage}"
IMAGE_NAME="${IMAGE_NAME:-flydb}"
TAG="${TAG:-latest}"

# check docker command
if ! [ -x "$(command -v docker)" ]; then
echo "Docker is not installed"
exit 1
fi

# check go command
if ! [ -x "$(command -v go)" ]; then
echo "Go is not installed"
exit 1
fi

if [ -z "$IMAGE_NAME" ] || [ -z "$TAG" ]; then
echo "Please set DOCKER_USERNAME, IMAGE_NAME and TAG environment variables"
exit 1
fi

go build -o bin/flydb-server cmd/server/cli/flydb-server.go

echo "IMAGE_NAME: $IMAGE_NAME"
echo "TAG: $TAG"

# build docker image
docker build -t "$DOCKER_USERNAME/$IMAGE_NAME:$TAG" -f docker/Dockerfile .

22 changes: 22 additions & 0 deletions kubernetes/flydb-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: flydb-deployment
namespace: flydb-system
spec:
replicas: 1
selector:
matchLabels:
app: flydb
template:
metadata:
labels:
app: flydb
spec:
containers:
- name: flydb-container
image: bytestorage/flydb:v1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8999
hostPort: 8999
4 changes: 4 additions & 0 deletions kubernetes/flydb-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: flydb-system
13 changes: 13 additions & 0 deletions kubernetes/flydb-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: flydb-service
namespace: flydb-system
spec:
selector:
app: flydb
ports:
- protocol: TCP
port: 8999
targetPort: 8999
type: NodePort

0 comments on commit 4a36750

Please sign in to comment.