Golang push server cluster

Related tags

gopush-cluster
Overview

gopush-cluster

gopush-cluster is a go push server cluster.

Features

  • light weight
  • high performance
  • pure golang implementation
  • message expired
  • offline message store
  • public message or private message push
  • multiple subscribers (can restrict max subscribers)
  • heartbeat(service heartbeat or tcp keepalive)
  • auth (if a subscriber not auth then can't connect to comet node)
  • multiple protocol (websocket, tcp, todo http longpolling)
  • stat
  • cluster support (easy add or remove comet & web & message node)
  • failover support (zookeeper)

Architecture

gopush-cluster

Document

English

中文

LICENSE

gopush-cluster is is distributed under the terms of the GNU General Public License, version 3.0 GPLv3

Issues
  • golang中多goroutine操作map时直接赋值不用加锁?

    golang中多goroutine操作map时直接赋值不用加锁?

    你好, 看到rand_lb.go中有这样的代码: r.Clients在这里未加锁直接修改r.Clients = tmpClients,在其他地方会被读取,这种赋值需要加锁吧?难道是高级用法?

    tmpClients := make(map[string]*WeightRpc, len(r.Clients))
            for addr, client := range r.Clients {
                if client == nil {
                    continue
                }
                tmpClients[addr] = client
                if client.Addr == retryAddr {
                    client.Client = rpcTmp
                }
            }
            // atomic update clients
            r.Clients = tmpClients
    
    opened by jinhao 19
  • no title

    no title

    Just wondering how can I connect to the push-cluster using web socket or tcp since I can not find any sample code here.

    Say, I am looking to implement a chatroom that users can pub/sub messages via web socket or tcp. How can I do this with the help of gopush-cluster? If I implement it on my own, the code should be like this:

    netConn, err := net.Dial("tcp", "127.0.0.1:9999")
    ws, _, err := websocket.NewClient(netConn, URL, nil, readBuffer, writeBuffer)
    # read message
    err = ws.ReadJSON(&v)
    # write message
    err = ws.WriteJSON(&v)
    

    I mean, what should I do in the client side to connect to the gopush-cluster and receive, send messages?

    opened by ghost 17
  • 楼主能不能做一个docker版本供测试

    楼主能不能做一个docker版本供测试

    楼主能不能做一个docker版本供测试??

    opened by alexwhen 11
  • 关于Migrate的疑惑

    关于Migrate的疑惑

    首先很感谢这个库,由于这个库我知晓了不少分布式架构知识。 另外这个库是我学习golang以来研究的第一份源码,有个地方有些疑惑,希望能得到回答。

    关于Migrate, 我查看cometchannel.go看到应该是comet在接到Migrate消息后nodeWeightMap更新到最新,然后去检查当前记录的channel key的一致性hash是否是本节点,如果不是就移除并且关闭此channel对应的所有长连接。 上述理解,应该没问题吧。

    我非常疑惑的是通知Migrate的时机,是由comet节点Add事件以外的事件触发的(Del和Update)。rpc/comet.go L195

    一个一致性hash环,不是应该被删除的节点上的key会被分散到其他节点。而添加节点的话,会从其他节点里匀出一部分到新节点么,那为什么在新节点出现的时候不去通知已有节点把该匀出来那些key清理掉?

    如果是节点被删除,那其他正常节点也没必要有清理操作啊,他们本身已有的那些key并不会因为某节点的删除而产生所属变化啊。

    可能我的问题比较小白,还请见谅,在下对golang和分布式都是初学,想了很久也没搞懂这个问题。

    opened by molon 10
  • 使用etcd,而不是zookeeper

    使用etcd,而不是zookeeper

    etcd是coreos的一个子项目,基本是参照zookeeper的一个go版本

    https://github.com/coreos/etcd

    功能基本一样,是否考虑用etcd来替换zookeeper?

    opened by panjunyong 6
  • 推送速度

    推送速度

    如果playload是512byte,每秒可以推送多少个啊

    opened by hepin1989 6
  • 第7步配置貌似 文件不起作用

    第7步配置貌似 文件不起作用

    $ nohup ./message -c message.conf & $ nohup ./comet -c comet.conf & $ nohup ./web -c web.conf &

    我查看到8090断网未监听,而 80端口监听了。 还有,只监听localhost 换成非127 ip无法连接。修改配置文件,换成0.0.0.0 也不是监听所所有。

    opened by anotheros 6
  • 按照步骤无法正常跑通测试

    按照步骤无法正常跑通测试

    hi, 我是在一台centos 6.4 x86_64环境下进行搭建的。

    按照步骤 可以跑起来message web comet三个进程

    [[email protected] bin]# netstat -apn | grep web tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 16761/./web tcp 0 0 127.0.0.1:8091 0.0.0.0:* LISTEN 16761/./web tcp 0 0 127.0.0.1:8190 0.0.0.0:* LISTEN 16761/./web tcp 0 0 127.0.0.1:48539 127.0.0.1:6970 ESTABLISHED 16761/./web tcp 0 0 127.0.0.1:50988 127.0.0.1:2181 ESTABLISHED 16761/./web tcp 0 0 127.0.0.1:36149 127.0.0.1:8070 ESTABLISHED 16761/./web [[email protected] bin]# netstat -apn | grep comet tcp 0 0 127.0.0.1:6968 0.0.0.0:* LISTEN 16754/./comet tcp 0 0 127.0.0.1:6969 0.0.0.0:* LISTEN 16754/./comet tcp 0 0 127.0.0.1:6970 0.0.0.0:* LISTEN 16754/./comet tcp 0 0 127.0.0.1:6971 0.0.0.0:* LISTEN 16754/./comet tcp 0 0 127.0.0.1:6972 0.0.0.0:* LISTEN 16754/./comet tcp 0 0 127.0.0.1:6970 127.0.0.1:48539 ESTABLISHED 16754/./comet tcp 0 0 127.0.0.1:36147 127.0.0.1:8070 ESTABLISHED 16754/./comet tcp 0 0 127.0.0.1:50986 127.0.0.1:2181 ESTABLISHED 16754/./comet [[email protected] bin]# netstat -apn | grep message tcp 0 0 127.0.0.1:8170 0.0.0.0:* LISTEN 16748/./message tcp 0 0 127.0.0.1:8070 0.0.0.0:* LISTEN 16748/./message tcp 0 0 127.0.0.1:8070 127.0.0.1:36149 ESTABLISHED 16748/./message tcp 0 0 127.0.0.1:8070 127.0.0.1:36147 ESTABLISHED 16748/./message tcp 0 0 127.0.0.1:50985 127.0.0.1:2181 ESTABLISHED 16748/./message

    测试结果:

    [[email protected] bin]# curl -d "test2" 'http://localhost:8091/admin/push/public?expire=600' 404 page not found

    其他相关服务: root 4612 1 0 11:05 pts/1 00:00:10 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /data/programfiles/zookeeper-3.4.5/bin/../build/classe root 4671 1 0 11:07 pts/0 00:00:03 /etc/init.d/redis-server /etc/redis/redis.conf root 4708 1819 0 11:16 pts/0 00:00:00 sudo su - root 4709 4708 0 11:16 pts/0 00:00:00 su - root 4710 4709 0 11:16 pts/0 00:00:00 -bash root 16480 1 0 13:15 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld mysql 16582 16480 0 13:15 pts/0 00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/r root 16748 4710 0 13:44 pts/0 00:00:00 ./message -c message.conf nobody 16754 4710 0 13:44 pts/0 00:00:00 ./comet -c comet.conf root 16761 4710 0 13:45 pts/0 00:00:00 ./web -c web.conf

    求指教 谢谢

    opened by lpisces 6
  • 客户端能够订阅多个频道吗?

    客户端能够订阅多个频道吗?

    comet使用tcp连接 第二次sub其他channel时貌似会把前一个断开,并再次连接前一个channel

    opened by RaymondChou 5
  • fix-404-error

    fix-404-error

    opened by houbaron 0
  • user channel list 求余的问题

    user channel list 求余的问题

    //func (l *ChannelList) Bucket(key string) *ChannelBucket 
    idx := uint(h.Sum32()) & uint(Conf.ChannelBucket-1)  //其中 ChannelBucket = runtime.NumCPU()
    

    只有当x=2^n(n为自然数)时,a % x = a & (x - 1 )才成立, 又服务器cpu至少我见过有10核12核的

    那么这里就计算出的idx会有问题吧

    opened by SongCF 1
  • bug for regexp

    bug for regexp

    file path: message/redis.go

    reg := regexp.MustCompile("(.+)@(.+)#(.+)|(.+)@(.+)")
    

    This match for ""@""# or ""@"", but for the file like *.conf, comment(#) is not required.

    So, it's a good idea for change to the following

    reg := regexp.MustCompile("(.+)@(.+)")
    
    opened by freelamb 1
  • Modify absolute dependency path to relative and Add mid config

    Modify absolute dependency path to relative and Add mid config

    1. Modify absolute dependency path to relatvie path , when to fork gopush-cluster project, can save project to anywhere, will not dependency origin project .
    2. Add config field mid_use_long_timestamp (default is yes), let user can select long or short timestamp to use. Because redis ZADD score dose not support whole int64, so when use long timestamp as mid, it will lead mid has been changed when save private message to redis, if use short timestamp , it will be work. For some business the short timestamp as mid is enough.
    opened by 0RaymondJiang0 1
Releases(v1.0.4)
  • v1.0.4(May 28, 2014)

    Changes:

    Bugfixes:

    Fixed /1/time/get http handler timeid value error Fixed HandleWrite goroutine memory leak. Fixed old version protocol compatibility.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.3(Apr 30, 2014)

    Changes:

    • Refactor message module, add more log.
    • Refactor web module, add more log, http api add version in url.
    • Refactor comet module, add more log.

    New Features:

    Bugfixes:

    • Fixed redis clean expired message function connection leak bug.
    Source code(tar.gz)
    Source code(zip)
Owner
Terry.Mao
Terry.Mao
Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.

Homepage Download Blog/News @uniqush Introduction Uniqush (\ˈyü-nə-ku̇sh\ "uni" pronounced as in "unified", and "qush" pronounced as in "cushion") is

Uniqush 1.3k Jul 11, 2021
Cluster extensions for Sarama, the Go client library for Apache Kafka 0.9

Cluster extensions for Sarama, the Go client library for Apache Kafka 0.9 (and later).

Black Square Media 984 Jul 26, 2021
⚡ HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, Safari and OSX apps, using the APNs HTTP/2 protocol.

APNS/2 APNS/2 is a go package designed for simple, flexible and fast Apple Push Notifications on iOS, OSX and Safari using the new HTTP/2 Push provide

Adam Jones 2.5k Jul 24, 2021
Golang push server cluster

gopush-cluster gopush-cluster is a go push server cluster. Features light weight high performance pure golang implementation message expired offline m

Terry.Mao 2k Jul 22, 2021
The Xiaomi message push service is a system-level channel on MIUI and is universal across the platform, which can provide developers with stable, reliable, and efficient push services.

Go-Push-API MiPush、JiPush、UMeng MiPush The Xiaomi message push service is a system-level channel on MIUI and is universal across the platform, which c

houseme 3 Jun 28, 2021
Apache Kafka Web UI for exploring messages, consumers, configurations and more with a focus on a good UI & UX.

Kowl - Apache Kafka Web UI Kowl (previously known as Kafka Owl) is a web application that helps you to explore messages in your Apache Kafka cluster a

CloudHut 1.5k Jul 24, 2021
websocket based messaging server written in golang

Guble Messaging Server Guble is a simple user-facing messaging and data replication server written in Go. Overview Guble is in an early state (release

Sebastian Mancke 148 Jun 3, 2021
Easy to use distributed event bus similar to Kafka

chukcha Easy to use distributed event bus similar to Kafka. The event bus is designed to be used as a persistent intermediate storage buffer for any k

Yuriy Nasretdinov 19 May 19, 2021
The implementation of the pattern observer

Event This is package implements pattern-observer Fast example import ( "github.com/agoalofalife/event" ) func main() { // create struct e := even

Ilya 41 Jul 6, 2021
Chanify is a safe and simple notification tools. This repository is command line tools for Chanify.

Chanify is a safe and simple notification tools. For developers, system administrators, and everyone can push notifications with API.

Chanify 572 Jul 24, 2021
Machinery is an asynchronous task queue/job queue based on distributed message passing.

Machinery Machinery is an asynchronous task queue/job queue based on distributed message passing. V2 Experiment First Steps Configuration Lock Broker

Richard Knop 5.4k Jul 15, 2021
Go client library SDK for Ably realtime messaging service

Ably Go A Go client library for www.ably.io, the realtime messaging service. Installation ~ $ go get -u github.com/ably/ably-go/ably Feature support T

Ably Realtime - our client library SDKs and libraries 33 Jul 15, 2021
A generic oplog/replication system for microservices

REST Operation Log OpLog is used as a real-time data synchronization layer between a producer and consumers. Basically, it's a generic database replic

Dailymotion 107 Jul 8, 2021
Inspr is an application mesh for simple, fast and secure development of distributed applications.

Inspr is an engine for running distributed applications, using multiple communication patterns such as pub sub and more, focused on type consistency a

Inspr 37 Jul 22, 2021