https://github.com/wupeaking/redgo
an key-value database implemented by golang
https://github.com/wupeaking/redgo
golang key-value-database redis
Last synced: 3 months ago
JSON representation
an key-value database implemented by golang
- Host: GitHub
- URL: https://github.com/wupeaking/redgo
- Owner: wupeaking
- License: gpl-3.0
- Created: 2017-05-20T14:09:46.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-13T10:40:10.000Z (almost 9 years ago)
- Last Synced: 2024-06-21T02:17:33.773Z (almost 2 years ago)
- Topics: golang, key-value-database, redis
- Language: Go
- Size: 1010 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## 一个golang版本的redis的单机数据库实现 (仅仅为了学习)
[](https://travis-ci.org/wupeaking/redgo)
[](https://godoc.org/github.com/wupeaking/redgo)
[](https://codecov.io/gh/wupeaking/redgo?branch=master)
## 安装
> 源码build
```shell
# 1. 要求安装go
# 2. clone
export GOPATH=`pwd`
mkdir -p $GOPATH/src/github.com/wupeaking && cd $GOPATH/src/github.com/wupeaking
git clone git@github.com:wupeaking/redgo.git && cd redgo
# build
make
```
> 生成docker镜像
```shell
# 1. 要求安装docker
# 2. clone
mkdir -p `pwd`/src/github.com/wupeaking && cd $GOPATH/src/github.com/wupeaking
git clone git@github.com:wupeaking/redgo.git && cd redgo
export GOPATH=`pwd`
# 执行make
make docker
```
## 在宿主机上使用
* 增加一个配置文件 config.yaml
```shell
host: 0.0.0.0
port: 6379
```
* 启动服务
```shell
# ./redgo
```
## 在docker环境运行
```shell
# 使用默认配置文件
docker run -p 6379:6379 --name=redgo -d redgo:v0.0.1
# 如果需要更改配置文件 挂载配置文件路径 配置文件名为 config.yaml
docker run --net=host -v `pwd`:/etc/redgo --name=redgo -d redgo:v0.0.1
```
* 使用redis客户端连接
```shell
# redis-cli
> set demo helloworld
> get demo
> helloworld
> lpush listdemo aa bb cc dd
> lrange listdemo -1
aa
bb
cc
dd
> ....
```