https://github.com/uxff/flexdrive
A flexible extending drive, distributed cloud storage system using gRPC and distributed election algorithm.
https://github.com/uxff/flexdrive
distributed-storage election-algorithm golang grpc
Last synced: 27 days ago
JSON representation
A flexible extending drive, distributed cloud storage system using gRPC and distributed election algorithm.
- Host: GitHub
- URL: https://github.com/uxff/flexdrive
- Owner: uxff
- License: mit
- Created: 2020-01-11T13:43:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-05-06T14:38:53.000Z (9 months ago)
- Last Synced: 2025-05-06T15:52:16.451Z (9 months ago)
- Topics: distributed-storage, election-algorithm, golang, grpc
- Language: Go
- Homepage:
- Size: 6.19 MB
- Stars: 28
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flexdrive
English | [中文](README.zhCN.md)
A distributed cloud disk system.
golang gin framework is used in the back end, Bootstrap is used in the front end, and gRPC protocol is used for cluster communication.
Has the following characteristics:
- a. One node provides both web and gRPC storage services.
- b. It can be expanded horizontally indefinitely by adding storage nodes in a distributed cluster. Theoretically, the space is unlimited.
- c. A file is randomly distributed on at least three nodes to prevent file loss caused by single point of failure and improve service reliability.
- d. The cluster uses distributed load balancing to upload and back up files to nodes with the least load.
- e. The cluster uses Golang as the main development language, which is independent after compilation and can be deployed and run in container;
- f. The gRPC communication protocol is used between clusters for heartbeat and node synchronization.
- g. Provide a background management interface to meet content controllable requirements.
Cluster operation structure diagram:


Node internal structure diagram:

It supports mysql for database, you can use sqlite instead.
## Get Started
Prepare your environment variables
| Env Variables |Example |Description|
|--:|--:|--:|
|SERVEADMIN |127.0.0.1:10011 |address and port for administrators|
|SERVECUSTOMER |127.0.0.1:10012 |address and port for guests|
|SERVECLUSTER |127.0.0.1:10013 |address and port for cluster communication|
|DATADSN |mysql://user:pass@tcp(127.0.0.1:3306)/flexdrive?charset=utf8mb4 |DNS of database|
|STORAGEDIR |./data/ |physical file storage|
Compiling:
```
$ go build -o flexdrive cmd/node/main.go
```
Run by single node:
```
$ SERVEADMIN=127.0.0.1:10011 SERVECUSTOMER=127.0.0.1:10012 SERVECLUSTER=127.0.0.1:10013 CLUSTERMEMBERS=127.0.0.1:10013,127.0.0.1:10023,127.0.0.1:10033 DATADSN='sqlite3://./flexdrive.db' STORAGEDIR=./data/ ./main
```
Run by multing nodes:
```
sh runcluster.sh
```
Visit admin web via: http://127.0.0.1:10011
Visit guest web via: http://127.0.0.1:10012