Skip to content

Commit

Permalink
Merge branch 'arana-db:master' into feat_shadow_config
Browse files Browse the repository at this point in the history
  • Loading branch information
Lvnszn committed Jul 20, 2022
2 parents 8a2eb21 + 29e05f0 commit 3127966
Show file tree
Hide file tree
Showing 232 changed files with 15,663 additions and 4,451 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# If you want to matrix build , you can append the following list.
matrix:
go_version:
- 1.16
- 1.18
os:
- ubuntu-latest

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
name: Release
on:
release:
types: [created]
types: [ created ]

jobs:
releases-matrix:
Expand All @@ -29,9 +29,9 @@ jobs:
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
goos: [linux, windows]
goarch: ["386", amd64, arm]
exclude:
goos: [ linux, windows ]
goarch: [ "386", amd64, arm ]
exclude:
- goarch: "arm"
goos: windows

Expand All @@ -42,6 +42,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://golang.org/dl/go1.16.15.linux-amd64.tar.gz"
goversion: "https://go.dev/dl/go1.18.3.linux-amd64.tar.gz"
project_path: "./cmd/arana"
binary_name: "arana"
3 changes: 2 additions & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ jobs:
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
go_version: "1.16"
go_version: "1.18"
golangci_lint_version: "v1.46.2" # use latest version by default
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: http://github.com/golangci/golangci-lint
rev: v1.42.1
rev: v1.46.2
hooks:
- id: golangci-lint
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# builder layer
FROM golang:1.16-alpine AS builder
FROM golang:1.18-alpine AS builder

RUN apk add --no-cache upx

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ docker-build:
integration-test:
@go clean -testcache
go test -tags integration -v ./test/...
go test -tags integration-db_tbl -v ./integration_test/scene/db_tbl/...
go test -tags integration-db -v ./integration_test/scene/db/...
go test -tags integration-tbl -v ./integration_test/scene/tbl/...

clean:
@rm -rf coverage.txt
Expand All @@ -50,4 +53,4 @@ prepareLic:

.PHONY: license
license: prepareLic
$(GO_LICENSE_CHECKER) -v -a -r -i vendor $(LICENSE_DIR)/license.txt . go && [[ -z `git status -s` ]]
$(GO_LICENSE_CHECKER) -v -a -r -i vendor $(LICENSE_DIR)/license.txt . go && [[ -z `git status -s` ]]
69 changes: 54 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,87 @@
# arana
[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/arana-db/arana/blob/master/LICENSE)
# Arana

<div align=center>
<img src="https://raw.githubusercontent.com/arana-db/arana/master/docs/pics/arana-main.png"/>
</div>

`Arana` is a Cloud Native Database Proxy. It can be deployed as a Database mesh sidecar. It provides transparent data access capabilities,
when using `arana`, user doesn't need to care about the `sharding` details of database, they can use it just like a single `MySQL` database.

## Overview

[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/arana-db/arana/blob/master/LICENSE)
[![codecov](https://codecov.io/gh/arana-db/arana/branch/master/graph/badge.svg)](https://codecov.io/gh/arana-db/arana)
[![Go Report Card](https://goreportcard.com/badge/github.com/arana-db/arana)](https://goreportcard.com/report/github.com/arana-db/arana)
[![Release](https://img.shields.io/github/v/release/arana-db/arana)](https://img.shields.io/github/v/release/arana-db/arana)
[![Docker Pulls](https://img.shields.io/docker/pulls/aranadb/arana)](https://img.shields.io/docker/pulls/aranadb/arana)

| **Stargazers Over Time** | **Contributors Over Time** |
|:-----------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| [![Stargazers over time](https://starchart.cc/arana-db/arana.svg)](https://starchart.cc/arana-db/arana) | [![Contributor over time](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=arana-db/arana)](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=arana-db/arana) |

![](./docs/pics/arana-logo.png)

## Introduction | [中文](https://github.com/arana-db/arana/blob/master/README_CN.md)

Arana is a db proxy. It can be deployed as a sidecar.
First, `Arana` is a Cloud Native Database Proxy. It provides transparent data access capabilities, when using `arana`,
user doesn't need to care about the `sharding` details of database, they can use it just like a single `MySQL` database.
`Arana` also provide abilities of `Multi Tenant`, `Distributed transaction`, `Shadow database`, `SQL Audit`, `Data encrypt / decrypt`
and so on. Through simple config, user can use these abilities provided by `arana` directly.

Second, `Arana` can also be deployed as a Database mesh sidecar. As a Database mesh sidecar, arana switches data access from
client mode to proxy mode, which greatly optimizes the startup speed of applications. It provides the ability to manage database
traffic, it takes up very little container resources, doesn't affect the performance of application services in the container, but
provides all the capabilities of proxy.

## Architecture

<img src="https://raw.githubusercontent.com/arana-db/arana/master/docs/pics/arana-architecture.png"/>

## Features

| feature | complete |
| -- | -- |
| single db proxy ||
| read write splitting | × |
| tracing | × |
| metrics | × |
| sql audit | × |
| sharding | × |
| multi tenant | × |
| **Feature** | **Complete** |
|:-----------------------:|:------------:|
| Single DB Proxy ||
| Read Write Splitting ||
| Sharding ||
| Multi Tenant ||
| Distributed Primary Key | WIP |
| Distributed Transaction | WIP |
| Shadow Table | WIP |
| Database Mesh | WIP |
| Tracing / Metrics | WIP |
| SQL Audit | Roadmap |
| Data encrypt / decrypt | Roadmap |

## Getting started

Please reference this link [Getting Started](https://github.com/arana-db/arana/discussions/172)

```
arana start -c ${configFilePath}
```

### Prerequisites

+ MySQL server 5.7+
+ Go 1.18+
+ MySQL Server 5.7+

## Design and implementation

## Roadmap

## Built With
- [tidb](https://github.com/pingcap/tidb) - The sql parser used

- [TiDB](https://github.com/pingcap/tidb) - The SQL parser used

## Contact

Arana Chinese Community Meeting Time: **Every Saturday At 9:00PM GMT+8**

<img src="https://raw.githubusercontent.com/arana-db/arana/master/docs/pics/dingtalk-group.jpeg" width="300px"/>

## Contributing

Thanks for your help improving the project! We are so happy to have you! We have a contributing guide to help you get involved in the Arana project.

## License
Arana software is licenced under the Apache License Version 2.0. See the [LICENSE](https://github.com/arana-db/arana/blob/master/LICENSE) file for details.
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/arana-db/arana/blob/master/LICENSE)
[![codecov](https://codecov.io/gh/arana-db/arana/branch/master/graph/badge.svg)](https://codecov.io/gh/arana-db/arana)

![](./docs/pics/arana-logo.png)
![](./docs/pics/arana-main.png)

## 简介 | [English](https://github.com/arana-db/arana/blob/master/README.md)

Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/arana-db/arana/blob/master/LICENSE)
[![codecov](https://codecov.io/gh/arana-db/arana/branch/master/graph/badge.svg)](https://codecov.io/gh/arana-db/arana)

![](./docs/pics/arana-logo.png)
![](./docs/pics/arana-main.png)

## 简介

Expand Down
4 changes: 1 addition & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import (
_ "github.com/arana-db/arana/cmd/tools"
)

var (
Version = "0.1.0"
)
var Version = "0.1.0"

func main() {
rootCommand := &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const slogan = `
/ _ | / _ \/ _ | / |/ / _ |
/ __ |/ , _/ __ |/ / __ |
/_/ |_/_/|_/_/ |_/_/|_/_/ |_|
High performance, powerful DB Mesh.
Arana, A High performance & Powerful DB Mesh sidecar.
_____________________________________________
`
Expand Down
70 changes: 53 additions & 17 deletions conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,40 +40,76 @@ data:
type: mysql
sql_max_limit: -1
tenant: arana
conn_props:
capacity: 10
max_capacity: 20
idle_timeout: 60
groups:
- name: employees_0000
nodes:
- name: arana-node-1
- name: node0
host: arana-mysql
port: 3306
username: root
password: "123456"
database: employees
database: employees_0000
weight: r10w10
labels:
zone: shanghai
conn_props:
readTimeout: "1s"
writeTimeout: "1s"
parseTime: true
loc: Local
charset: utf8mb4,utf8

parameters:
maxAllowedPacket: 256M
- name: node0_r_0
host: arana-mysql
port: 3306
username: root
password: "123456"
database: employees_0000_r
weight: r0w0
parameters:
maxAllowedPacket: 256M
- name: employees_0001
nodes:
- name: node1
host: arana-mysql
port: 3306
username: root
password: "123456"
database: employees_0001
weight: r10w10
parameters:
maxAllowedPacket: 256M
- name: employees_0002
nodes:
- name: node2
host: arana-mysql
port: 3306
username: root
password: "123456"
database: employees_0002
weight: r10w10
parameters:
maxAllowedPacket: 256M
- name: employees_0003
nodes:
- name: node3
host: arana-mysql
port: 3306
username: root
password: "123456"
database: employees_0003
weight: r10w10
parameters:
maxAllowedPacket: 256M
sharding_rule:
tables:
- name: employees.student
allow_full_scan: true
db_rules:
- column: uid
type: scriptExpr
expr: parseInt($value % 32 / 8)
tbl_rules:
- column: uid
type: scriptExpr
expr: $value % 32
step: 32
topology:
db_pattern: employees_0000
tbl_pattern: student_${0000...0031}
db_pattern: employees_${0000..0003}
tbl_pattern: student_${0000..0031}
attributes:
sqlMaxLimit: -1

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
version: "3"
services:
mysql:
image: mysql:8.0
image: mysql:5.7
container_name: arana-mysql
networks:
- local
Expand All @@ -41,7 +41,7 @@ services:
arana:
build: .
container_name: arana
image: aranadb/arana:latest
image: aranadb/arana:master
networks:
- local
ports:
Expand Down
Binary file added docs/pics/arana-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pics/arana-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pics/arana-db-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pics/arana-db-v0.2.sketch
Binary file not shown.
Binary file added docs/pics/arana-main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pics/dingtalk-group.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3127966

Please sign in to comment.