Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gosnowflake

> 编程语言
Open source

Snowflake is a network service for generating unique ID numbers at high scale with some simple guarantees (golang).

399 stars0 likes0 views
WebsiteGitHub

About

Snowflake is a network service for generating unique ID numbers at high scale with some simple guarantees (golang).

Terry-Mao/gosnowflake

Terry-Mao/gosnowflake is a network service for generating unique ID numbers at high scale with some simple guarantees (golang).

Requeriments

golang 1.2 is required.

zookeeper is required.

Installation

Just pull Terry-Mao/gosnowflake from github using go get:

…

Document

…

RPC API

SnowflakeRPC.NextId: generate a snowflake id.

SnowflakeRPC.DatacenterId: get gosnowflake service's datacenterId.

SnowflakeRPC.Timestamp: get gosnowflake service's current timestamp.

SnowflakeRPC.Ping: get gosnowflake service's status.

Usage

go
if err := Init(MyConf.ZKServers, MyConf.ZKPath, MyConf.ZKTimeout); err != nil {
    panic(err)
}
c := NewClient(MyConf.WorkerId)                                             
defer c.Close()
defer c.Destroy()
time.Sleep(1 * time.Second)                                             
id, err := c.Id()                                                       
if err != nil {                                                         
    panic(err)
}                                                                       
fmt.Printf("gosnwoflake id: %d\n", id)                                  

Highly Available

use heartbeat or keepalived apply a VIP for the client.

a easy keepalived configration: here

(1.0.1)

use zookeeper for client failover

golang client sdk: here

(1.1)

LICENSE

gosnowflake is is distributed under the terms of the GNU General Public License, version 3.0 GPLv3

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Go

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言