All Projects → flike → Idgo

flike / Idgo

id generator based on MySQL

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Idgo

Type Graphql Series
Typescript GraphQL Server built with TypeGraphQL
Stars: ✭ 249 (-9.12%)
Mutual labels:  redis
Node Url Shortener
A modern, minimalist, and lightweight URL shortener using Node.js and Redis
Stars: ✭ 259 (-5.47%)
Mutual labels:  redis
Redisdesktopmanager Windows
RedisDesktopManager-Windows 安装包和编译教程
Stars: ✭ 268 (-2.19%)
Mutual labels:  redis
Cronlock
cronlock lets you deploy cronjobs cluster-wide without worrying about overlaps. It uses Redis to keep track of locks.
Stars: ✭ 253 (-7.66%)
Mutual labels:  redis
Javaguide
「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,首选 JavaGuide!
Stars: ✭ 114,707 (+41763.87%)
Mutual labels:  redis
Jetcache
JetCache is a Java cache framework.
Stars: ✭ 3,167 (+1055.84%)
Mutual labels:  redis
Redis
Native port of Redis for Windows. Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs. This repository contains unofficial port of Redis to Windows.
Stars: ✭ 4,186 (+1427.74%)
Mutual labels:  redis
Springboot Learn
🌹springboot常用框架整合示例,涉及多种网站监控,数据缓存,网络通信,持久层,权限管理,常用工具等
Stars: ✭ 270 (-1.46%)
Mutual labels:  redis
Spring Boot Demo
Spring Boot & Spring Cloud & Spring Security Demo Case(Spring学习示例实战项目)
Stars: ✭ 255 (-6.93%)
Mutual labels:  redis
Goatee
A Redis-backed notification server written in Go
Stars: ✭ 265 (-3.28%)
Mutual labels:  redis
Phpredisadmin
Simple web interface to manage Redis databases.
Stars: ✭ 2,841 (+936.86%)
Mutual labels:  redis
Advanced Java
😮 Core Interview Questions & Answers For Experienced Java(Backend) Developers | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识
Stars: ✭ 59,142 (+21484.67%)
Mutual labels:  redis
Lock
高性能分布式并发锁, 行为限流
Stars: ✭ 260 (-5.11%)
Mutual labels:  redis
Atlas Of Thrones
An interactive "Game of Thrones" map powered by Leaflet, PostGIS, and Redis.
Stars: ✭ 253 (-7.66%)
Mutual labels:  redis
Redis Lua Scaling Bloom Filter
LUA Redis scripts for a scaling bloom filter
Stars: ✭ 268 (-2.19%)
Mutual labels:  redis
Rollout
Feature flippers.
Stars: ✭ 2,774 (+912.41%)
Mutual labels:  redis
Poseidon
poseidon项目是基于Java的商城项目,包括前台商城(),后台管理系统。系统采用SpringCloud+SpringBoot+Mybatis+React等框架进行开发。包括首页展示,商品搜索,商品推荐,购物车,订单等模块。
Stars: ✭ 261 (-4.74%)
Mutual labels:  redis
Zoom
A blazing-fast datastore and querying engine for Go built on Redis.
Stars: ✭ 272 (-0.73%)
Mutual labels:  redis
Redisearch
A query and indexing engine for Redis, providing secondary indexing, full-text search, and aggregations.
Stars: ✭ 3,393 (+1138.32%)
Mutual labels:  redis
Egg Commerce
Stars: ✭ 264 (-3.65%)
Mutual labels:  redis

1. Overview 中文主页

Build Status

Idgo is a sequential id generator which can generate batch ids through MySQL transcation way. Its features as follows:

  • The id generated by idgo is by order.
  • generate batch ids through MySQL transcation way, dose not increase the load of MySQL.
  • When idgo process crashed, admin can restart idgo, does not worry about generating repetitive ids.
  • Idgo talks with clients using redis protocol, developer can connect idgo using redis sdk.

Someone knows the resolution of generating id with MySQL:

REPLACE INTO Tickets64 (stub) VALUES ('a');
SELECT LAST_INSERT_ID();

The disadvantage of this resolution is that generates one id need query MySQL once. When generating id too quickly, leading MySQL overload. This is why I build this project to generating ids.

2. The architecture of idgo

Idgo talks with clients using redis protocol, developer can connect to idgo using redis sdk. Every Key will mapped to a table storing in MySQL, and the table only has one row data to record the id.

idgo_arch

Idgo only supports four commands of redis as follows:

  • SET key value, set the initial value of id generator in idgo.
  • GET key, get the value of key.
  • EXISTS key, check the key if exist.
  • DEL key, delete the key in idgo.
  • SELECT index, just a mock select command, prevent the select command error.

3. Install and use idgo

Install idgo following these steps:

	1. Install Go environment, the version of Go   
is greater than 1.3.
	2. Install godep. `go get github.com/tools/godep`. 
	3. git clone https://github.com/flike/idgo src/github.com/flike/idgo
	4. cd src/github.com/flike/idgo
	5. source ./dev.sh
	6. make
	7. set the config file.
 	8. run idgo. `./bin/idgo -config=etc/idgo.toml`

Set the config file(etc/idgo.toml):

#the address of idgo
addr="127.0.0.1:6389"
#log_path: /Users/flike/src 
log_level="debug"

[storage_db]
mysql_host="127.0.0.1"
mysql_port=3306
db_name="idgo_test"
user="root"
password=""
max_idle_conns=64

Examples:


#start idgo
➜  idgo git:(master) ✗ ./bin/idgo -config=etc/idgo.toml
2016/04/07 11:51:20 - INFO - server.go:[62] - [server] "NewServer" "Server running" "netProto=tcp|address=127.0.0.1:6389" req_id=0
2016/04/07 11:51:20 - INFO - main.go:[80] - [main] "main" "Idgo start!" "" req_id=0

#start a redis client to connecting idgo, and set/get the key.
➜  ~  redis-cli -p 6389
redis 127.0.0.1:6389> get abc
(integer) 0
redis 127.0.0.1:6389> set abc 100
OK
redis 127.0.0.1:6389> get abc
(integer) 101
redis 127.0.0.1:6389> get abc
(integer) 102
redis 127.0.0.1:6389> get abc
(integer) 103
redis 127.0.0.1:6389> get abc
(integer) 104

4. HA

When the idgo crashed, you can restart idgo and reset the key by increasing a fixed offset.

5. License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].