beehive

package module
v0.0.0-...-01d9b8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

Beehive

Beehive是一个用于构建Multi-Raft的强一致系统的类库。应用程序完全不需要关心分布式的问题,只需要编写自己的数据存储的单机代码即可。

特性

  • Strong consistent persistence storage
  • High availability
  • Horizontal scalability
  • Auto Rebalance

Quick start

一个基于Redis协议的存储服务

例子代码在 这里

make example-redis
docker-compose up

启动完毕后,启动了一个4个节点的集群,4个节点都可以对外提供Redis的服务,任何一个节点对于客户端都是等价的。4个节点监听6371~6374四个端口。 利用redis-cli来连接任意一个节点来试试吧。

一个基于http协议的自定义存储服务

例子代码在 这里

make example-http
docker-compose -f ./docker-compose-http up

启动完毕后,启动了一个4个节点的集群,4个节点都可以对外提供http的服务,任何一个节点对于客户端都是等价的。4个节点监听6371~6374四个端口。

curl "http://127.0.0.1:6371/set?key=k&value=v"

curl "http://127.0.0.1:6371/get?key=k"

curl "http://127.0.0.1:6371/delete?key=k"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRaftStoreFromFile

func CreateRaftStoreFromFile(dataPath string,
	metadataStorage storage.MetadataStorage,
	dataStorages []storage.DataStorage,
	opts ...raftstore.Option) (raftstore.Store, error)

CreateRaftStoreFromFile create raftstore from a toml configuration file.

Types

type ProphetCfg

type ProphetCfg struct {
	RPCAddr                     string   `toml:"rpcAddr"`
	StoreMetadata               bool     `toml:"storeMetadata"`
	ClientAddr                  string   `toml:"clientAddr"`
	PeerAddr                    string   `toml:"peerAddr"`
	Seed                        string   `toml:"seed"`
	Clusters                    []string `toml:"clusters"`
	LeaderLeaseTTL              int64    `toml:"leaderLeaseTTL"`
	MaxRPCCons                  int      `toml:"maxRPCCons"`
	MaxRPCConnIdle              int64    `toml:"maxRPCConnIdle"`
	MaxRPCTimeout               int64    `toml:"maxRPCTimeout"`
	CountResourceReplicas       int      `toml:"countResourceReplicas"`
	MaxScheduleRetries          int      `toml:"maxScheduleRetries"`
	MaxScheduleInterval         int64    `toml:"maxScheduleInterval"`
	MinScheduleInterval         int64    `toml:"minScheduleInterval"`
	TimeoutWaitOperatorComplete int64    `toml:"timeoutWaitOperatorComplete"`
	MaxFreezeScheduleInterval   int64    `toml:"maxFreezeScheduleInterval"`
	MaxRebalanceLeader          uint64   `toml:"maxRebalanceLeader"`
	MaxRebalanceReplica         uint64   `toml:"maxRebalanceReplica"`
	MaxScheduleReplica          uint64   `toml:"maxScheduleReplica"`
	MaxLimitSnapshotsCount      uint64   `toml:"maxLimitSnapshotsCount"`
	MinAvailableStorageUsedRate int      `toml:"minAvailableStorageUsedRate"`
}

ProphetCfg prophet cfg

Directories

Path Synopsis
example
pb
mem

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL