Giter Club home page Giter Club logo

mpush's Introduction

源码

ps:由于源码分别在github和码云有两份,最新的代码以github为主

服务调用关系

源码测试

  1. git clone https://github.com/mpusher/mpush.git
  2. 导入到eclipse或Intellij IDEA
  3. 打开mpush-test模块,所有的测试代码都在该模块下
  4. 修改配置文件src/test/resource/application.conf文件修改方式参照 服务部署第6点
  5. 运行com.mpush.test.sever.ServerTestMain.java启动长链接服务
  6. 运行com.mpush.test.client.ConnClientTestMain.java 模拟一个客户端
  7. 运行com.mpush.test.push.PushClientTestMain 模拟给用户下发消息
  8. 可以在控制台观察日志看服务是否正常运行,消息是否下发成功

服务部署

说明:mpush 服务只依赖于zookeeper和redis,当然还有JDK>=1.8
  1. 安装jdk 1.8 以上版本并设置%JAVA_HOME%

  2. 安装zookeeper (安装配置步骤略)

  3. 安装Redis (安装配置步骤略)

  4. 下载mpush server 最新的正式包https://github.com/mpusher/mpush/releases

  5. 解压下载的tar包tar -zvxf mpush-release-0.0.2.tar.gz到 mpush 目录, 结构如下

    drwxrwxr-x 2 shinemo shinemo  4096 Aug 20 09:30 bin —> 启动脚本
    drwxrwxr-x 2 shinemo shinemo  4096 Aug 20 09:52 conf —> 配置文件
    drwxrwxr-x 2 shinemo shinemo  4096 Aug 20 09:29 lib —> 核心类库
    -rw-rw-r-- 1 shinemo shinemo 11357 May 31 11:07 LICENSE
    drwxrwxr-x 2 shinemo shinemo  4096 Aug 20 09:32 logs —> 日志目录
    -rw-rw-r-- 1 shinemo shinemo    21 May 31 11:07 README.md
    drwxrwxr-x 2 shinemo shinemo  4096 Aug 20 09:52 tmp
    
  6. 修改 conf 目录下的 vi mpush.conf文件, mpush.conf里的配置项会覆盖同目录下的reference.conf文件

       #主要修改以下配置
       mp.net.connect-server-port=3000//长链接服务对外端口, 公网端口
       mp.zk.server-address="127.0.0.1:2181"//zk 机器的地址
       mp.redis={//redis 相关配置
             nodes:["127.0.0.1:6379"] //格式是ip:port
             cluster-model:single //single, cluster
       }
       //还有用于安全加密的RSA mp.security.private-key 和 mp.security.public-key 等...

    如果要修改其他配置请参照reference.conf文件

  7. 给bin目录下的脚本增加执行权限chmod u+x *.sh

  8. 执行./mp.sh start 启动服务, 查看帮助./mp.sh 目前支持的命令:

    Usage: ./mp.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}

    set-env.sh 用于增加和修改jvm启动参数,比如堆内存、开启远程调试端口、开启jmx等

  9. cd logs目录,cat mpush.out查看服务是否启动成功

  10. 集成部署,比如集成到现有web工程一起部署到tomcat,可以添加如下依赖

<dependency>
   <groupId>com.github.mpusher</groupId>
   <artifactId>mpush-boot</artifactId>
   <version>0.0.2</version>
</dependency>

启动入口com.mpush.bootstrap.ServerLauncher.java

配置文件详解

##################################################################################################################
#
# NOTICE:
#
# 系统配置文件,所有列出的项是系统所支持全部配置项
# 如果要覆盖某项的值可以添加到mpush.conf中。
#
# 配置文件格式采用HOCON格式。解析库由https://github.com/typesafehub/config提供。
# 具体可参照说明文档,比如含有特殊字符的字符串必须用双引号包起来。
#
##################################################################################################################

mp {
 #基础配置
 home=${user.dir} //程序工作目录

 #日志配置
 log-level=warn
 log-dir=${mp.home}/logs
 log-conf-path=${mp.home}/conf/logback.xml

 #核心配置
 core {
     max-packet-size=10k //系统允许传输的最大包的大小
     compress-threshold=10k //数据包启用压缩的临界值,超过该值后对数据进行压缩
     min-heartbeat=3m //最小心跳间隔
     max-heartbeat=3m //最大心跳间隔
     max-hb-timeout-times=2 //允许的心跳连续超时的最大次数
     session-expired-time=1d //用于快速重连的session 过期时间默认1天
     epoll-provider=netty //nio:jdk自带,netty:由netty实现
 }

 #安全配置
 security {
     #rsa 私钥、公钥key长度为1024;可以使用脚本bin/rsa.sh生成, @see com.mpush.tools.crypto.RSAUtils#main
     private-key="MIIBNgIBADANBgkqhkiG9w0BAQEFAASCASAwggEcAgEAAoGBAKCE8JYKhsbydMPbiO7BJVq1pbuJWJHFxOR7L8Hv3ZVkSG4eNC8DdwAmDHYu/wadfw0ihKFm2gKDcLHp5yz5UQ8PZ8FyDYvgkrvGV0ak4nc40QDJWws621dm01e/INlGKOIStAAsxOityCLv0zm5Vf3+My/YaBvZcB5mGUsPbx8fAgEAAoGAAy0+WanRqwRHXUzt89OsupPXuNNqBlCEqgTqGAt4Nimq6Ur9u2R1KXKXUotxjp71Ubw6JbuUWvJg+5Rmd9RjT0HOUEQF3rvzEepKtaraPhV5ejEIrB+nJWNfGye4yzLdfEXJBGUQzrG+wNe13izfRNXI4dN/6Q5npzqaqv0E1CkCAQACAQACAQACAQACAQA="
     public-key="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCghPCWCobG8nTD24juwSVataW7iViRxcTkey/B792VZEhuHjQvA3cAJgx2Lv8GnX8NIoShZtoCg3Cx6ecs+VEPD2fBcg2L4JK7xldGpOJ3ONEAyVsLOttXZtNXvyDZRijiErQALMTorcgi79M5uVX9/jMv2Ggb2XAeZhlLD28fHwIDAQAB"
     aes-key-length=16 //AES key 长度
 }

 #网络配置
 net {
     local-ip=""  //本地ip, 默认取第一个网卡的本地IP
     public-ip="" //外网ip, 默认取第一个网卡的外网IP

     connect-server-bind-ip=""  //connSrv 绑定的本地ip (默认anyLocalAddress 0.0.0.0 or ::0)
     connect-server-register-ip=${mp.net.public-ip}  //公网ip, 注册到zk中的ip, 默认是public-ip
     connect-server-port=3000 //长链接服务对外端口, 公网端口
     connect-server-register-attr { //注册到zk里的额外属性,比如配置权重,可在alloc里排序
         weight:1
     }

     gateway-server-bind-ip=""  //gatewaySrv 绑定的本地ip (默认anyLocalAddress 0.0.0.0 or ::0)
     gateway-server-register-ip=${mp.net.local-ip}  //本地ip, 注册到zk中的ip, 默认是local-ip
     gateway-server-port=3001 //网关服务端口, 内部端口
     gateway-server-net=tcp //网关服务使用的网络类型tcp/udp/sctp/udt

     gateway-client-port=4000 //UDP 客户端端口
     gateway-server-multicast="239.239.239.88" //239.0.0.0~239.255.255.255为本地管理组播地址,仅在特定的本地范围内有效
     gateway-client-multicast="239.239.239.99" //239.0.0.0~239.255.255.255为本地管理组播地址,仅在特定的本地范围内有效
     gateway-client-num=1 //网关客户端连接数

     admin-server-port=3002 //控制台服务端口, 内部端口
     ws-server-port=0 //websocket对外端口, 公网端口, 0表示禁用websocket
     ws-path="/" //websocket path

     public-host-mapping { //本机局域网IP和公网IP的映射关系, 该配置后续会被废弃
         //"10.0.10.156":"111.1.32.137"
         //"10.0.10.166":"111.1.33.138"
     }

     snd_buf { //tcp/udp 发送缓冲区大小
         connect-server=32k
         gateway-server=0
         gateway-client=0 //0表示使用操作系统默认值
     }

     rcv_buf { //tcp/udp 接收缓冲区大小
         connect-server=32k
         gateway-server=0
         gateway-client=0 //0表示使用操作系统默认值
     }

     write-buffer-water-mark { //netty 写保护
         connect-server-low=32k
         connect-server-high=64k
         gateway-server-low=10m
         gateway-server-high=20m
     }

     traffic-shaping { //流量整形配置
         gateway-client {
             enabled:false
             check-interval:100ms
             write-global-limit:30k
             read-global-limit:0
             write-channel-limit:3k
             read-channel-limit:0
         }

         gateway-server {
             enabled:false
             check-interval:100ms
             write-global-limit:0
             read-global-limit:30k
             write-channel-limit:0
             read-channel-limit:3k
         }

         connect-server {
             enabled:false
             check-interval:100ms
             write-global-limit:0
             read-global-limit:100k
             write-channel-limit:3k
             read-channel-limit:3k
         }
     }
 }

 #Zookeeper配置
 zk {
     server-address="127.0.0.1:2181" //多台机器使用","分隔如:"10.0.10.44:2181,10.0.10.49:2181" @see org.apache.zookeeper.ZooKeeper#ZooKeeper()
     namespace=mpush
     digest=mpush //zkCli.sh acl 命令 addauth digest mpush
     watch-path=/
     retry {
         #initial amount of time to wait between retries
         baseSleepTimeMs=3s
         #max number of times to retry
         maxRetries=3
         #max time in ms to sleep on each retry
         maxSleepMs=5s
     }
     connectionTimeoutMs=5s
     sessionTimeoutMs=5s
 }

 #Redis集群配置
 redis {
     cluster-model=single //single,cluster,sentinel
     sentinel-master:""
     nodes:[] s//["127.0.0.1:6379"]格式ip:port
     password="" //your password
     config {
         maxTotal:8,
         maxIdle:4,
         minIdle:1,
         lifo:true,
         fairness:false,
         maxWaitMillis:5000,
         minEvictableIdleTimeMillis:300000,
         softMinEvictableIdleTimeMillis:1800000,
         numTestsPerEvictionRun:3,
         testOnCreate:false,
         testOnBorrow:false,
         testOnReturn:false,
         testWhileIdle:false,
         timeBetweenEvictionRunsMillis:60000,
         blockWhenExhausted:true,
         jmxEnabled:false,
         jmxNamePrefix:pool,
         jmxNameBase:pool
     }
 }

 #HTTP代理配置
 http {
     proxy-enabled=false //启用Http代理
     max-conn-per-host=5 //每个域名的最大链接数, 建议web服务nginx超时时间设长一点, 以便保持长链接
     default-read-timeout=10s //请求超时时间
     max-content-length=5m //response body 最大大小
     dns-mapping { //域名映射外网地址转内部IP, 域名部分不包含端口号
         //"mpush.com":["127.0.0.1:8080", "127.0.0.1:8081"]
     }
 }

 #线程池配置
 thread {
     pool {
         conn-work:0 //接入服务线程池大小,0表示线程数根据cpu核数动态调整(2*cpu)
         gateway-server-work:0 //网关服务线程池大小,0表示线程数根据cpu核数动态调整(2*cpu)
         http-work:0 //http proxy netty client work pool size,0表示线程数根据cpu核数动态调整(2*cpu)
         ack-timer:1 //处理ACK消息超时
         push-task:0 //消息推送中心,推送任务线程池大小, 如果为0表示使用Gateway Server的work线程池,tcp下推荐0
         gateway-client-work:0 //网关客户端线程池大小,0表示线程数根据cpu核数动态调整(2*cpu),该线程池在客户端运行
         push-client:2 //消息推送回调处理,该线程池在客户端运行

         event-bus { //用户处理内部事件分发
             min:1
             max:16
             queue-size:10000 //大量的online,offline
         }

         mq { //用户上下线消息, 踢人等
             min:1
             max:4
             queue-size:10000
         }
     }
 }

 #推送消息流控
 push {
    flow-control { //qps = limit/(duration)
         global:{ //针对非广播推送的流控,全局有效
             limit:5000 //qps = 5000
             max:0 //UN limit
             duration:1s //1s
         }

         broadcast:{ //针对广播消息的流控,单次任务有效
             limit:3000 //qps = 3000
             max:100000 //10w
             duration:1s //1s
         }
    }
 }

 #系统监控配置
 monitor {
     dump-dir=${mp.home}/tmp
     dump-stack=false //是否定时dump堆栈
     dump-period=1m  //多久监控一次
     print-log=true //是否打印监控日志
     profile-enabled=false //开启性能监控
     profile-slowly-duration=10ms //耗时超过10ms打印日志
 }

 #SPI扩展配置
 spi {
     thread-pool-factory:"com.mpush.tools.thread.pool.DefaultThreadPoolFactory"
     dns-mapping-manager:"com.mpush.common.net.HttpProxyDnsMappingManager"
 }
}
  1. 未完待续...

mpush's People

Contributors

maksimwei avatar ohun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpush's Issues

mpush在centos7存在虚拟网卡情况下 mp.net.public-host-mapping无效

OS :centos7 64
mpush :0.7.1
mp.net.public-host-mapping 配置后,alloc:9999 一直显示的是虚拟网卡的IP,修改mpush.conf & reference.conf 均无效,执行下面的命令删除虚拟网卡后才能显示mpush.conf配置的IP。

  1. virsh net-list
  2. virsh net-destroy default
  3. virsh net-undefine default
  4. systemctl restart libvirtd.service

望确认。

RedisManager错误

从队列的右边入队应该是调用jedis.rpush方法,代码里调用的是jedis.lpush

ConnClientChannelHandler 232行为什么这么写?

`

private void bindUser(ClientConfig client) {
    BindUserMessage message = new BindUserMessage(connection);
    message.userId = client.getUserId();
    message.tags = "test";//???
    message.send();
    connection.getSessionContext().setUserId(client.getUserId());
    LOGGER.debug("send bind user message={}", message);
}

`

整合在tomcat中报错

开发环境:spring+springmvc

2017-09-21 17:17:38,809 INFO  [RMI TCP Connection(2)-127.0.0.1] [mpush.cache.log] - begin init redis...
2017-09-21 17:17:38,811 INFO  [RMI TCP Connection(2)-127.0.0.1] [mpush.cache.log] - init redis success...
2017-09-21 17:17:38,819 ERROR [RMI TCP Connection(2)-127.0.0.1] [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
java.lang.IllegalArgumentException: 'request' is already in use
	at io.netty.util.ConstantPool.createOrThrow(ConstantPool.java:113)
	at io.netty.util.ConstantPool.newInstance(ConstantPool.java:95)
	at io.netty.util.AttributeKey.newInstance(AttributeKey.java:55)
	at com.mpush.netty.http.NettyHttpClient.<init>(NettyHttpClient.java:64)
	at com.mpush.core.MPushServer.getHttpClient(MPushServer.java:138)
	at com.mpush.core.handler.HttpProxyHandler.<init>(HttpProxyHandler.java:61)
	at com.mpush.core.server.ConnectionServer.lambda$init$5(ConnectionServer.java:86)
	at com.mpush.common.MessageDispatcher.register(MessageDispatcher.java:68)
	at com.mpush.core.server.ConnectionServer.init(ConnectionServer.java:86)
	at com.mpush.bootstrap.job.ServerBoot.start(ServerBoot.java:44)
	at com.mpush.bootstrap.job.BootJob.startNext(BootJob.java:41)
	at com.mpush.bootstrap.job.ServiceDiscoveryBoot.start(ServiceDiscoveryBoot.java:38)
	at com.mpush.bootstrap.job.BootJob.startNext(BootJob.java:41)
	at com.mpush.bootstrap.job.ServiceRegistryBoot.start(ServiceRegistryBoot.java:36)
	at com.mpush.bootstrap.job.BootJob.startNext(BootJob.java:41)
	at com.mpush.bootstrap.job.CacheManagerBoot.start(CacheManagerBoot.java:36)
	at com.mpush.bootstrap.job.BootJob.startNext(BootJob.java:41)
	at com.mpush.bootstrap.job.BootChain$1.start(BootChain.java:44)
	at com.mpush.bootstrap.job.BootChain.start(BootChain.java:60)
	at com.mpush.bootstrap.ServerLauncher.start(ServerLauncher.java:74)
	at com.thinkgem.jeesite.common.web.MpushStartupListener.onApplicationEvent(MpushStartupListener.java:21)
	at com.thinkgem.jeesite.common.web.MpushStartupListener.onApplicationEvent(MpushStartupListener.java:13)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:778)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485)
	at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624)
	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672)
	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543)
	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484)
	at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
[2017-09-21 05:17:38,866] Artifact jeesite:war exploded: Artifact is deployed successfully
[2017-09-21 05:17:38,866] Artifact jeesite:war exploded: Deploy took 25,316 milliseconds
2017-09-21 17:18:30,044 INFO  [mp-t-2-monitor] [mpush.monitor.log] - {"results":{"jvm-gc":{"fullGcCollectionCount":3,"fullGcCollectionTime":310,"spanFullGcCollectionCount":1,"spanFullGcCollectionTime":210,"spanYongGcCollectionCount":3,"spanYongGcCollectionTime":44,"yongGcCollectionCount":17,"yongGcCollectionTime":355},"jvm-info":{"freeMemory":"1062m","load":3.755859375,"maxMemory":"3641m","pid":"7217","totalMemory":"1489m"},"jvm-memory":{"edenSpaceCommitted":1282932736,"edenSpaceInit":67108864,"edenSpaceMax":1294467072,"edenSpaceUsed":372832040,"heapMemoryCommitted":1561853952,"heapMemoryInit":268435456,"heapMemoryMax":3817865216,"heapMemoryUsed":447371432,"nonHeapMemoryCommitted":112091136,"nonHeapMemoryInit":2555904,"nonHeapMemoryMax":-1,"nonHeapMemoryUsed":109055848,"oldGenCommitted":209190912,"oldGenInit":179306496,"oldGenMax":2863661056,"oldGenUsed":55924232,"permGenCommitted":0,"permGenInit":0,"permGenMax":0,"permGenUsed":0,"survivorCommitted":69730304,"survivorInit":11010048,"survivorMax":69730304,"survivorUsed":18615160},"jvm-thread":{"daemonThreadCount":58,"deadLockedThreadCount":0,"threadCount":94,"totalStartedThreadCount":122},"jvm-thread-pool":{"ack-timer":{"activeCount(workingThread)":0,"corePoolSize":1,"maxPoolSize":2147483647,"poolSize(workThread)":0,"queueSize(blockedTask)":0},"conn-worker":{"activeCount(workingThread)":16,"poolSize(workThread)":16,"queueSize(blockedTask)":0},"event-bus":{"activeCount(workingThread)":0,"corePoolSize":1,"maxPoolSize":16,"poolSize(workThread)":0,"queueSize(blockedTask)":0},"mq":{"activeCount(workingThread)":0,"corePoolSize":1,"maxPoolSize":4,"poolSize(workThread)":0,"queueSize(blockedTask)":0}}},"timestamp":1505985510041}

压测性能怎么样?

你好,mpush性能怎么样,各组件单节点情况可支持多少用户,最大用户情况下推送频率?

zk节点权限

如果这么配置的话digest=mpush,
namespace节点的访问密码是多少呢?
是不是该配置成digest=mpush:password,这样?

mpush在端口不通的情况下锁被占用,导致程序卡死

1.前提: 可能是mpush端口不通,导致channel.connect() timeout
2.在Tcpconnection 中doConnect 方法占用了锁。
3.此时在mpushservice 中调用ondestroy (主线程),其中点进去看到调用了4. 4.connection.setAutoConnect()方法,该方法也需要抢占锁。造成了界面卡顿。
5.又,如果在此时又一次启动mpush, 在mpushService 的onstartcommand方法中(主线程)MPush.I.client.start()方法也需要抢占锁,也会导致主界面卡顿

定时发送

请教一哈:

   我能在PushCenter L73 push,中添加定时发送吗?

MPUSH集群下无法推送

一台电脑上部署两个mpush,alloc也能显示,但是在安卓手机上进行绑定和启动推送都显示连接成功和握手成功,心跳也ok,但是点击send时就显示mpush断开重连,日志显示unsupported command,这是什么问题呢

window下无法启动服务端

下载0.0.4版,执行bin目录下的mp.cmd start 命令,显示如下错误:
Unrecognized option: -jar ../boot.jar
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
貌似没有boot.jar ?
尝试修改mp.cmd,改成bin目录下的bootstrap.jar,错误仍然一样。

启动报错

启动报错:
[root@localhost bin]# ./mp.sh start /opt/app/mpush/bin/env-mp.sh:行2: $'\r': 未找到命令 /opt/app/mpush/bin/env-mp.sh:行17: $'\r': 未找到命令 /opt/app/mpush/bin/env-mp.sh:行20: $'\r': 未找到命令 /opt/app/mpush/bin/env-mp.sh:行25: $'\r': 未找到命令 /opt/app/mpush/bin/env-mp.sh:行28: $'\r': 未找到命令 /opt/app/mpush/bin/env-mp.sh:行80: 未预期的符号$'do\r'' 附近有语法错误
'opt/app/mpush/bin/env-mp.sh:行80: `do
MPush JMX enabled by default
./mp.sh:行99: cygpath: 未找到命令
Using config:
mkdir: 无法创建目录"": 没有那个文件或目录

mkdir: 无法创建目录"": 没有那个文件或目录
Starting mpush ... STARTED`

启动服务bin/zkServer.sh start

启动服务的时候:
JMX disabled by user request
Using config: /usr/local/mpush/bin/../conf/mpush.conf
Starting mpush ... STARTED

查看日志: tailf -n 30 logs/mpush.out 显示:
Error: Could not find or load main class com.mpush.bootstrap.Main

请问什么情况?

支持ios?

这个支持IOS的日程有安排吗?

ServerTestMain启动报错

[main-SendThread(127.0.0.1:2181)] WARN - org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)

启动ServerTest时报错了 Connection refused: no further information

java.net.ConnectException: Connection refused: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170) 10:53:43.142 - [main-SendThread(127.0.0.1:2181)] DEBUG - o.a.zookeeper.ClientCnxnSocketNIO - Ignoring exception during shutdown output java.nio.channels.ClosedChannelException: null at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:797) at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:407) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:207) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170)
启动ServerTest时报错了

mpush-test 中的 spi 没有起作用

启动 com.mpush.test.sever.ServerTestMain.java 后没有打印 SimpleCacheMangerFactory 中的信息

@Spi(order = 2)
public final class SimpleCacheMangerFactory implements CacheManagerFactory {
    @Override
    public CacheManager get() {
        log("CacheManager");
        return FileCacheManger.I;
    }

    public void log(String str) {
        System.out.println("oldfeel-----------" + str);
    }
}

Android client 久放后接收不到消息推送

当前项目集成了MPush,在项目中绑定并接成功收到消息推送后,将手机放置一段时间,就发现消息推送接收不到了,然后后台服务还是存在的,日志里面也只有启动和绑定的信息。但是如果我在应用管理里面将MPUSH的服务进程杀死,五秒后重启 就能立马接收到消息推送了,至于客户端关于MPUSH的代码也是沿用的示列demo

关于学习mpush 的问题

大佬们,请教几个问题:
1.为啥要自研推送系统?极光不好用吗
2.极光有啥缺点?
3.RabbitMQ 做推送有啥短板?
4.自定义消息协议有啥优势?
5.推送系统和即时通讯系统有啥关联和区别?

regards!

用户上线下线怎么配置?

UserStatusChangeListener如何使用... 前端开发的求教

`public class UserStatusChangeListener implements MQMessageReceiver {

private static final Logger LOGGER = LoggerFactory.getLogger(com.mpush.client.user.UserStatusChangeListener.class);

//只需要一台机器注册online、offline 消息通道
public UserStatusChangeListener() {
    MQClientFactory.create().subscribe(ONLINE_CHANNEL, this);
    MQClientFactory.create().subscribe(OFFLINE_CHANNEL, this);
}

@Override
public void receive(String channel, Object message) {
    LOGGER.info("  UserStatusChangeListener   " + channel + "       " + message);
}

}`

RSA解密异常

在网络多次连续通断的情况下,会偶发性的出现该异常,异常信息如下:
2019-12-17 14:03:10.231 - [mp-conn-work-3-3] ERROR - com.mpush.tools.crypto.RSAUtils - decryptByPrivateKey ex javax.crypto.BadPaddingException: Decryption error at sun.security.rsa.RSAPadding.unpadV15(RSAPadding.java:383) at sun.security.rsa.RSAPadding.unpad(RSAPadding.java:294) at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:363) at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:389) at javax.crypto.Cipher.doFinal(Cipher.java:2222) at com.mpush.tools.crypto.RSAUtils.doFinal(RSAUtils.java:278) at com.mpush.tools.crypto.RSAUtils.decryptByPrivateKey(RSAUtils.java:255) at com.mpush.common.security.RsaCipher.decrypt(RsaCipher.java:44) at com.mpush.common.message.BaseMessage.decodeBinaryBody0(BaseMessage.java:90) at com.mpush.common.message.BaseMessage.decodeBody(BaseMessage.java:64) at com.mpush.common.handler.BaseMessageHandler.handle(BaseMessageHandler.java:45) at com.mpush.common.MessageDispatcher.onReceive(MessageDispatcher.java:86) at com.mpush.core.server.ServerChannelHandler.channelRead(ServerChannelHandler.java:72) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:1018) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:394) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:299) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) at java.lang.Thread.run(Thread.java:748) 2019-12-17 14:03:10.231 - [mp-conn-work-3-3] ERROR - com.mpush.common.MessageDispatcher - dispatch message ex, packet={cmd=5, cc=0, flags=1, sessionId=8, lrc=0, body=32}, connect=[channel=[id: 0x917a765b, L:/10.0.1.102:3000 - R:/10.0.1.253:33641], context=, status=1, lastReadTime=1576562590225, lastWriteTime=0], body=[-115, -113, -47, 23, -88, -3, -2, 35, 95, 42, -48, -109, 110, 4, -78, -47, 73, 16, 66, -35, -77, -67, 6, -103, -113, -2, 117, 78, 0, 96, 42, -23] com.mpush.tools.crypto.CryptoException: RSA decrypt ex at com.mpush.tools.crypto.RSAUtils.decryptByPrivateKey(RSAUtils.java:258) at com.mpush.common.security.RsaCipher.decrypt(RsaCipher.java:44) at com.mpush.common.message.BaseMessage.decodeBinaryBody0(BaseMessage.java:90) at com.mpush.common.message.BaseMessage.decodeBody(BaseMessage.java:64) at com.mpush.common.handler.BaseMessageHandler.handle(BaseMessageHandler.java:45) at com.mpush.common.MessageDispatcher.onReceive(MessageDispatcher.java:86) at com.mpush.core.server.ServerChannelHandler.channelRead(ServerChannelHandler.java:72) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:1018) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:394) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:299) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) at java.lang.Thread.run(Thread.java:748) Caused by: javax.crypto.BadPaddingException: Decryption error at sun.security.rsa.RSAPadding.unpadV15(RSAPadding.java:383) at sun.security.rsa.RSAPadding.unpad(RSAPadding.java:294) at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:363) at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:389) at javax.crypto.Cipher.doFinal(Cipher.java:2222) at com.mpush.tools.crypto.RSAUtils.doFinal(RSAUtils.java:278) at com.mpush.tools.crypto.RSAUtils.decryptByPrivateKey(RSAUtils.java:255) ... 24 common frames omitted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.