mpush 服务端配置 for windows 服务自动运行

mpush 服务端配置

以下安装部分是参照官方的步骤,

一、安装jdk1.8并配置环境变量

示例:  http://www.cnblogs.com/endv/p/6439860.html

二、Windows安装Redis

下载地址Github (https://github.com/MSOpenTech/redis/releases),

Redis-x64-3.2.100.zip

1.下载并解压,解压后如下

mpush 服务端配置 for windows 服务自动运行

2.使用cmd进入到Redis解压目录中,并使用脚本(redis-server.exe redis.windows.conf)执行即可,默认配置文件不需要修改

Microsoft Windows [版本 10.0.]
(c) Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\Redis-x64-3.2.100 D:\Redis-x64-3.2.>redis-server.exe redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2. (/) bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port:
| `-._ `._ / _.-' | PID: 12096
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-' [] Feb ::09.347 # Server started, Redis version 3.2.
[] Feb ::09.347 * The server is now ready to accept connections on port

三、Windows安装Zookeeper

官网直接下载Zookeeper最新版本(Zookeeper支持Windows和Linux)

1.下载并解压,解压后如下

mpush 服务端配置 for windows 服务自动运行

2.提供配置文件

将conf目录下的zoo_sample.conf重命名为zoo.conf

3.到bin目录下,双击zkServer.bat即可

Microsoft Windows [版本 10.0.]
(c) Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\zookeeper-3.5.-alpha\bin D:\zookeeper-3.5.-alpha\bin>zkServer.cmd
Microsoft Windows [版本 10.0.]
(c) Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\zookeeper-3.5.-alpha\bin D:\zookeeper-3.5.-alpha\bin>zkServer.cmd D:\zookeeper-3.5.-alpha\bin>call "C:\Program Files\Java\jdk1.8.0_121"\bin\java "-Dzookeeper.log.dir=D:\zookeeper-3.5.2-alpha\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-endv-server-DESKTOP-3ML7R0C.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "D:\zookeeper-3.5.2-alpha\bin\..\build\classes;D:\zookeeper-3.5.2-alpha\bin\..\build\lib\*;D:\zookeeper-3.5.2-alpha\bin\..\*;D:\zookeeper-3.5.2-alpha\bin\..\lib\*;D:\zookeeper-3.5.2-alpha\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper-3.5.2-alpha\bin\..\conf\zoo.cfg"
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - Reading configuration from: D:\zookeeper-3.5.-alpha\bin\..\conf\zoo.cfg
-- ::, [myid:] - WARN [main:VerifyingFileFactory@] - \tmp\zookeeper is relative. Prepend .\ to indicate that you're sure!
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - clientPortAddress is 0.0.0.0/0.0.0.0:
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - secureClientPort is not set
-- ::, [myid:] - INFO [main:DatadirCleanupManager@] - autopurge.snapRetainCount set to
-- ::, [myid:] - INFO [main:DatadirCleanupManager@] - autopurge.purgeInterval set to
-- ::, [myid:] - INFO [main:DatadirCleanupManager@] - Purge task is not scheduled.
-- ::, [myid:] - WARN [main:QuorumPeerMain@] - Either no config or no quorum defined in config, running in standalone mode
-- ::, [myid:] - INFO [main:ManagedUtil@] - Log4j found with jmx enabled.
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - Reading configuration from: D:\zookeeper-3.5.-alpha\bin\..\conf\zoo.cfg
-- ::, [myid:] - WARN [main:VerifyingFileFactory@] - \tmp\zookeeper is relative. Prepend .\ to indicate that you're sure!
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - clientPortAddress is 0.0.0.0/0.0.0.0:
-- ::, [myid:] - INFO [main:QuorumPeerConfig@] - secureClientPort is not set
-- ::, [myid:] - INFO [main:ZooKeeperServerMain@] - Starting server
-- ::, [myid:] - INFO [main:Environment@] - Server environment:zookeeper.version=3.5.-alpha-, built on // : GMT
-- ::, [myid:] - INFO [main:Environment@] - Server environment:host.name=DESKTOP-3ML7R0C
-- ::, [myid:] - INFO [main:Environment@] - Server environment:java.version=1.8.0_121
-- ::, [myid:] - INFO [main:Environment@] - Server environment:java.vendor=Oracle Corporation
-- ::, [myid:] - INFO [main:Environment@] - Server environment:java.home=C:\Program Files\Java\jdk1..0_121\jre
-- ::, [myid:] - INFO [main:Environment@] - Server environment:java.class.path=D:\zookeeper-3.5.-alpha\bin\..\build\classes;D:\zookeeper-3.5.-alpha\bin\..\build\lib\*;D:\zookeeper-3.5.-alpha\bin\..\zookeeper-3.5.-alpha.jar;D:\zookeeper-3.5.-alpha\bin\..\lib\commons-cli-1.2.jar;D:\zookeeper-3.5.-alpha\bin\..\lib\jackson-core-asl-1.9..jar;D:\zookeeper-3.5.-alpha\bin\..\lib\jackson-mapper-asl-1.9..jar;D:\zookeeper-3.5.-alpha\bin\..\lib\javacc.jar;D:\zookeeper-3.5.-alpha\bin\..\lib\jetty-6.1..jar;D:\zookeeper-3.5.-alpha\bin\..\lib\jetty-util-6.1..jar;D:\zookeeper-3.5.-alpha\bin\..\lib\jline-2.11.jar;D:\zookeeper-3.5.-alpha\bin\..\lib\log4j-1.2..jar;D:\zookeeper-3.5.-alpha\bin\..\lib\netty-3.10..Final.jar;D:\zookeeper-3.5.-alpha\bin\..\lib\servlet-api-2.5-.jar;D:\zookeeper-3.5.-alpha\bin\..\lib\slf4j-api-1.7..jar;D:\zookeeper-3.5.-alpha\bin\..\lib\slf4j-log4j12-1.7..jar;D:\zookeeper-3.5.-alpha\bin\..\conf
-- ::, [myid:] - INFO [main:Environment@] - Server environment:java.library.path=C:\Program Files\Java\jdk1..0_121\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1..0_121\Bin;C:\Program Files\Java\jdk1..0_121\jre\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.\;.
-- ::, [myid:] - INFO [main:Environment@] - Server environment:java.io.tmpdir=C:\Users\endv\AppData\Local\Temp\
-- ::, [myid:] - INFO [main:Environment@] - Server environment:java.compiler=<NA>
-- ::, [myid:] - INFO [main:Environment@] - Server environment:os.name=Windows
-- ::, [myid:] - INFO [main:Environment@] - Server environment:os.arch=amd64
-- ::, [myid:] - INFO [main:Environment@] - Server environment:os.version=10.0
-- ::, [myid:] - INFO [main:Environment@] - Server environment:user.name=endv
-- ::, [myid:] - INFO [main:Environment@] - Server environment:user.home=C:\Users\endv
-- ::, [myid:] - INFO [main:Environment@] - Server environment:user.dir=D:\zookeeper-3.5.-alpha\bin
-- ::, [myid:] - INFO [main:Environment@] - Server environment:os.memory.free=116MB
-- ::, [myid:] - INFO [main:Environment@] - Server environment:os.memory.max=1803MB
-- ::, [myid:] - INFO [main:Environment@] - Server environment:os.memory.total=123MB
-- ::, [myid:] - INFO [main:ZooKeeperServer@] - minSessionTimeout set to
-- ::, [myid:] - INFO [main:ZooKeeperServer@] - maxSessionTimeout set to
-- ::, [myid:] - INFO [main:ZooKeeperServer@] - Created server with tickTime minSessionTimeout maxSessionTimeout datadir \tmp\zookeeper\version- snapdir \tmp\zookeeper\version-
-- ::, [myid:] - INFO [main:Slf4jLog@] - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
-- ::, [myid:] - INFO [main:Slf4jLog@] - jetty-6.1.
-- ::, [myid:] - INFO [main:Slf4jLog@] - Started SelectChannelConnector@0.0.0.0:
-- ::, [myid:] - INFO [main:JettyAdminServer@] - Started AdminServer on address 0.0.0.0, port and command URL /commands
-- ::, [myid:] - INFO [main:NIOServerCnxnFactory@] - Configuring NIO connection handler with 10s sessionless connection timeout, selector thread(s), worker threads, and kB direct buffers.
-- ::, [myid:] - INFO [main:NIOServerCnxnFactory@] - binding to port 0.0.0.0/0.0.0.0:
-- ::, [myid:] - INFO [main:FileTxnSnapLog@] - Snapshotting: 0x0 to \tmp\zookeeper\version-\snapshot.
-- ::, [myid:] - INFO [main:ContainerManager@] - Using checkIntervalMs= maxPerMinute=

 四、安装mpush

1.解压mpush-release-0.7.1.tar.gz

mpush 服务端配置 for windows 服务自动运行

2.编辑Mpush配置文件(注意,只需要修改mpush.conf配置文件即可,不需要修改reference.conf),修改默认提供的Redis、Zookeeper服务器地址和端口信息(因为我redis和zookeeper直接部署在本机,所以不用修改)。

3.使用cmd进入到bin目录,启动Mpush(使用如下脚本java -Dmp.conf=D:\mpush-0.7.1\conf\mpush.conf -jar bootstrap.jar)

Microsoft Windows [版本 10.0.]
(c) Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-0.7.\bin D:\mpush-0.7.\bin>java -Dmp.conf=D:\mpush-0.7.\conf\mpush.conf -jar bootstrap.jar
Microsoft Windows [版本 10.0.]
(c) Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-0.7.\bin D:\mpush-0.7.\bin>java -Dmp.conf=D:\mpush-0.7.\conf\mpush.conf -jar bootstrap.jar
::05.468 - {
"conf" : "D:\\mpush-0.7.1\\conf\\mpush.conf",
"core" : {
"compress-threshold" : "10k",
"epoll-provider" : "netty",
"max-hb-timeout-times" : ,
"max-heartbeat" : "3m",
"max-packet-size" : "10k",
"min-heartbeat" : "3m",
"session-expired-time" : "1d"
},
"home" : "D:\\mpush-0.7.1\\bin",
"http" : {
"default-read-timeout" : "10s",
"dns-mapping" : {},
"max-conn-per-host" : ,
"max-content-length" : "5m",
"proxy-enabled" : true
},
"log-conf-path" : "D:\\mpush-0.7.1\\bin/conf/logback.xml",
"log-dir" : "D:\\mpush-0.7.1\\bin/logs",
"log-level" : "warn",
"monitor" : {
"dump-dir" : "D:\\mpush-0.7.1\\bin/tmp",
"dump-period" : "1m",
"dump-stack" : false,
"print-log" : true,
"profile-enabled" : false,
"profile-slowly-duration" : "10ms"
},
"net" : {
"admin-server-port" : ,
"connect-server-port" : ,
"gateway-client-multicast" : "239.239.239.99",
"gateway-client-num" : ,
"gateway-client-port" : ,
"gateway-server-multicast" : "239.239.239.88",
"gateway-server-net" : "tcp",
"gateway-server-port" : ,
"public-host-mapping" : {},
"rcv_buf" : {
"connect-server" : "32k",
"gateway-client" : ,
"gateway-server" :
},
"snd_buf" : {
"connect-server" : "32k",
"gateway-client" : ,
"gateway-server" :
},
"traffic-shaping" : {
"connect-server" : {
"check-interval" : "100ms",
"enabled" : false,
"read-channel-limit" : "3k",
"read-global-limit" : "100k",
"write-channel-limit" : "3k",
"write-global-limit" :
},
"gateway-client" : {
"check-interval" : "100ms",
"enabled" : false,
"read-channel-limit" : ,
"read-global-limit" : ,
"write-channel-limit" : "3k",
"write-global-limit" : "30k"
},
"gateway-server" : {
"check-interval" : "100ms",
"enabled" : false,
"read-channel-limit" : "3k",
"read-global-limit" : "30k",
"write-channel-limit" : ,
"write-global-limit" :
}
},
"write-buffer-water-mark" : {
"connect-server-high" : "64k",
"connect-server-low" : "32k",
"gateway-server-high" : "20m",
"gateway-server-low" : "10m"
},
"ws-path" : "/",
"ws-server-port" :
},
"push" : {
"flow-control" : {
"broadcast" : {
"duration" : "1s",
"limit" : ,
"max" :
},
"global" : {
"duration" : "1s",
"limit" : ,
"max" :
}
}
},
"redis" : {
"cluster-model" : "single",
"config" : {
"blockWhenExhausted" : true,
"fairness" : false,
"jmxEnabled" : false,
"jmxNameBase" : "pool",
"jmxNamePrefix" : "pool",
"lifo" : true,
"maxIdle" : ,
"maxTotal" : ,
"maxWaitMillis" : ,
"minEvictableIdleTimeMillis" : ,
"minIdle" : ,
"numTestsPerEvictionRun" : ,
"softMinEvictableIdleTimeMillis" : ,
"testOnBorrow" : false,
"testOnCreate" : false,
"testOnReturn" : false,
"testWhileIdle" : false,
"timeBetweenEvictionRunsMillis" :
},
"nodes" : [
"127.0.0.1:6379"
],
"password" : "",
"write-to-zk" : false
},
"security" : {
"aes-key-length" : ,
"private-key" : "MIIBNgIBADANBgkqhkiG9w0BAQEFAASCASAwggEcAgEAAoGBAKCE8JYKhsbydMPbiO7BJVq1pbuJWJHFxOR7L8Hv3ZVkSG4eNC8DdwAmDHYu/wadfw0ihKFm2gKDcLHp5yz5UQ8PZ8FyDYvgkrvGV0ak4nc40QDJWws621dm01e/INlGKOIStAAsxOityCLv0zm5Vf3+My/YaBvZcB5mGUsPbx8fAgEAAoGAAy0+WanRqwRHXUzt89OsupPXuNNqBlCEqgTqGAt4Nimq6Ur9u2R1KXKXUotxjp71Ubw6JbuUWvJg+5Rmd9RjT0HOUEQF3rvzEepKtaraPhV5ejEIrB+nJWNfGye4yzLdfEXJBGUQzrG+wNe13izfRNXI4dN/6Q5npzqaqv0E1CkCAQACAQACAQACAQACAQA=",
"public-key" : "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCghPCWCobG8nTD24juwSVataW7iViRxcTkey/B792VZEhuHjQvA3cAJgx2Lv8GnX8NIoShZtoCg3Cx6ecs+VEPD2fBcg2L4JK7xldGpOJ3ONEAyVsLOttXZtNXvyDZRijiErQALMTorcgi79M5uVX9/jMv2Ggb2XAeZhlLD28fHwIDAQAB"
},
"spi" : {
"dns-mapping-manager" : "com.mpush.common.net.HttpProxyDnsMappingManager",
"thread-pool-factory" : "com.mpush.tools.thread.pool.DefaultThreadPoolFactory"
},
"thread" : {
"pool" : {
"ack-timer" : ,
"conn-work" : ,
"event-bus" : {
"max" : ,
"min" : ,
"queue-size" :
},
"gateway-client-work" : ,
"gateway-server-work" : ,
"http-work" : ,
"mq" : {
"max" : ,
"min" : ,
"queue-size" :
},
"push-client" : ,
"push-task" :
}
},
"zk" : {
"connectionTimeoutMs" : "5s",
"digest" : "mpush",
"namespace" : "mpush",
"retry" : {
"baseSleepTimeMs" : "3s",
"maxRetries" : ,
"maxSleepMs" : "5s"
},
"server-address" : "127.0.0.1:2181",
"sessionTimeoutMs" : "5s",
"watch-path" : "/"
}
} ::05.548 - launch mpush server...
::05.749 - bootstrap chain starting...
::05.750 - start bootstrap job [CacheManagerBoot]
::05.958 - start bootstrap job [ServiceRegistryBoot]
::05.958 - init service registry waiting for connected...
::06.508 - start bootstrap job [ServerBoot(ConnectionServer)]
::07.100 - start ConnectionServer success on:
::07.317 - start bootstrap job [ServerBoot(GatewayServer)]
::07.363 - start GatewayServer success on:
::07.517 - start bootstrap job [ServerBoot(AdminServer)]
::07.571 - start AdminServer success on:
::07.572 - start bootstrap job [PushCenterBoot]
::07.663 - start bootstrap job [HttpProxyBoot]
::07.680 - start bootstrap job [MonitorBoot]
::07.681 - start bootstrap job [LastBoot]
::07.761 - bootstrap chain started.
::07.761 - ===================================================================
::07.762 - ====================MPUSH SERVER START SUCCESS=====================
::07.766 - ===================================================================

五、Windows安装Mpush-Alloc

1.解压alloc-release-0.7.1.tar.gz

2.修改配置文件(注意,这里不需要修改,如果分布式部署,修改zookeeper地址信息即可)。

3.使用cmd进入到alloc的bin目录,使用如下命令启动(java -Dmp.conf=D:\mpush-alloc-0.7.1\conf\mpush.conf -jar bootstrap.jar)

Microsoft Windows [版本 10.0.]
(c) Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-alloc-0.7.\bin D:\mpush-alloc-0.7.\bin>java -Dmp.conf=D:\mpush-alloc-0.7.\conf\mpush.conf -jar bootstrap.jar
Microsoft Windows [版本 10.0.]
(c) Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-alloc-0.7.\bin D:\mpush-alloc-0.7.\bin>java -Dmp.conf=D:\mpush-alloc-0.7.\conf\mpush.conf -jar bootstrap.jar
::42.425 - {
"conf" : "D:\\mpush-alloc-0.7.1\\conf\\mpush.conf",
"core" : {
"compress-threshold" : "10k",
"epoll-provider" : "netty",
"max-hb-timeout-times" : ,
"max-heartbeat" : "3m",
"max-packet-size" : "10k",
"min-heartbeat" : "3m",
"session-expired-time" : "1d"
},
"home" : "D:\\mpush-alloc-0.7.1\\bin",
"http" : {
"default-read-timeout" : "10s",
"dns-mapping" : {},
"max-conn-per-host" : ,
"max-content-length" : "5m",
"proxy-enabled" : false
},
"log-conf-path" : "D:\\mpush-alloc-0.7.1\\bin/conf/logback.xml",
"log-dir" : "D:\\mpush-alloc-0.7.1\\bin/logs",
"log-level" : "warn",
"monitor" : {
"dump-dir" : "D:\\mpush-alloc-0.7.1\\bin/tmp",
"dump-period" : "1m",
"dump-stack" : false,
"print-log" : true,
"profile-enabled" : false,
"profile-slowly-duration" : "10ms"
},
"net" : {
"admin-server-port" : ,
"alloc-server-port" : ,
"connect-server-port" : ,
"gateway-client-multicast" : "239.239.239.99",
"gateway-client-num" : ,
"gateway-client-port" : ,
"gateway-server-multicast" : "239.239.239.88",
"gateway-server-net" : "tcp",
"gateway-server-port" : ,
"public-host-mapping" : {},
"rcv_buf" : {
"connect-server" : "32k",
"gateway-client" : ,
"gateway-server" :
},
"snd_buf" : {
"connect-server" : "32k",
"gateway-client" : ,
"gateway-server" :
},
"traffic-shaping" : {
"connect-server" : {
"check-interval" : "100ms",
"enabled" : false,
"read-channel-limit" : "3k",
"read-global-limit" : "100k",
"write-channel-limit" : "3k",
"write-global-limit" :
},
"gateway-client" : {
"check-interval" : "100ms",
"enabled" : false,
"read-channel-limit" : ,
"read-global-limit" : ,
"write-channel-limit" : "3k",
"write-global-limit" : "30k"
},
"gateway-server" : {
"check-interval" : "100ms",
"enabled" : false,
"read-channel-limit" : "3k",
"read-global-limit" : "30k",
"write-channel-limit" : ,
"write-global-limit" :
}
},
"write-buffer-water-mark" : {
"connect-server-high" : "64k",
"connect-server-low" : "32k",
"gateway-server-high" : "20m",
"gateway-server-low" : "10m"
},
"ws-path" : "/",
"ws-server-port" :
},
"push" : {
"flow-control" : {
"broadcast" : {
"duration" : "1s",
"limit" : ,
"max" :
},
"global" : {
"duration" : "1s",
"limit" : ,
"max" :
}
}
},
"redis" : {
"cluster-model" : "single",
"config" : {
"blockWhenExhausted" : true,
"fairness" : false,
"jmxEnabled" : false,
"jmxNameBase" : "pool",
"jmxNamePrefix" : "pool",
"lifo" : true,
"maxIdle" : ,
"maxTotal" : ,
"maxWaitMillis" : ,
"minEvictableIdleTimeMillis" : ,
"minIdle" : ,
"numTestsPerEvictionRun" : ,
"softMinEvictableIdleTimeMillis" : ,
"testOnBorrow" : false,
"testOnCreate" : false,
"testOnReturn" : false,
"testWhileIdle" : false,
"timeBetweenEvictionRunsMillis" :
},
"nodes" : [
"127.0.0.1:6379"
],
"password" : "",
"write-to-zk" : false
},
"security" : {
"aes-key-length" : ,
"private-key" : "MIIBNgIBADANBgkqhkiG9w0BAQEFAASCASAwggEcAgEAAoGBAKCE8JYKhsbydMPbiO7BJVq1pbuJWJHFxOR7L8Hv3ZVkSG4eNC8DdwAmDHYu/wadfw0ihKFm2gKDcLHp5yz5UQ8PZ8FyDYvgkrvGV0ak4nc40QDJWws621dm01e/INlGKOIStAAsxOityCLv0zm5Vf3+My/YaBvZcB5mGUsPbx8fAgEAAoGAAy0+WanRqwRHXUzt89OsupPXuNNqBlCEqgTqGAt4Nimq6Ur9u2R1KXKXUotxjp71Ubw6JbuUWvJg+5Rmd9RjT0HOUEQF3rvzEepKtaraPhV5ejEIrB+nJWNfGye4yzLdfEXJBGUQzrG+wNe13izfRNXI4dN/6Q5npzqaqv0E1CkCAQACAQACAQACAQACAQA=",
"public-key" : "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCghPCWCobG8nTD24juwSVataW7iViRxcTkey/B792VZEhuHjQvA3cAJgx2Lv8GnX8NIoShZtoCg3Cx6ecs+VEPD2fBcg2L4JK7xldGpOJ3ONEAyVsLOttXZtNXvyDZRijiErQALMTorcgi79M5uVX9/jMv2Ggb2XAeZhlLD28fHwIDAQAB"
},
"spi" : {
"dns-mapping-manager" : "com.mpush.common.net.HttpProxyDnsMappingManager",
"thread-pool-factory" : "com.mpush.tools.thread.pool.DefaultThreadPoolFactory"
},
"thread" : {
"pool" : {
"ack-timer" : ,
"conn-work" : ,
"event-bus" : {
"max" : ,
"min" : ,
"queue-size" :
},
"gateway-client-work" : ,
"gateway-server-work" : ,
"http-work" : ,
"mq" : {
"max" : ,
"min" : ,
"queue-size" :
},
"push-client" : ,
"push-task" :
}
},
"zk" : {
"connectionTimeoutMs" : "5s",
"digest" : "mpush",
"namespace" : "mpush",
"retry" : {
"baseSleepTimeMs" : "3s",
"maxRetries" : ,
"maxSleepMs" : "5s"
},
"server-address" : "127.0.0.1:2181",
"sessionTimeoutMs" : "5s",
"watch-path" : "/"
}
} ::42.456 - launch alloc server...
::43.322 - ===================================================================
::43.322 - ====================ALLOC SERVER START SUCCESS=====================
::43.322 - ===================================================================

六、Android测试

note:测试时候,要确保Android和Alloc、MPush在同一个局域网内,能相互访问,或者Alloc、MPush部署在公网外。

1) 填写Alloc服务器地址(http:\/\/192.168.1.102:9999\/),注意以http:\/\/开头,且加端口号

2)点击BIND按钮

3)填写发送的消息

4)点击Start Push

5)点击Send Push

正常情况,客户端会受到由服务器端推送过来的消息

2、模拟IM

客户端1使用Android手机,客户端2使用浏览器模拟,客户端2给客户端1发送消息。如果有两个手机也可以,将界面的to:填写为对方的userid即可。

手机端操作如下

1) 填写Alloc服务器地址(http:\/\/192.168.1.102:9999\/),注意以http:\/\/开头,且加端口号

2)点击BIND按钮

3)在from输入自己的用户ID,user-0

4)点击Start Push

浏览器端打开测试地址(http:\/\/192.168.1.102:9999\/index.html)

http://192.168.1.102:9999/index.html

mpush 服务端配置 for windows 服务自动运行

手机浏览:

mpush 服务端配置 for windows 服务自动运行

输入手机端设置的用户ID(from位置),输入推送消息,点击send即可

手机端提示消息

mpush 服务端配置 for windows 服务自动运行

mpush 服务端配置 for windows 服务自动运行

七、注册 windows 服务 (未成功,有空再试)

以上虽然可以正常运行,在windows 窗口下,容易手痒X掉窗口,作为windows 服务来运行或许会比较好点

下面就将上面4个窗口注册到windows 服务中去。当然,也可以增加到系统的开机启动里,这样,重启系统后就可以自动运行了。

将下面代码修改相对应的路径后保存为:AutoStart.bat

sc delete "Endv Redis"
sc delete "Endv zookeeper"
sc delete "Endv mpush"
sc delete "Endv mpush-alloc" sc create "Endv Redis" binPath= "cmd.exe /c start D:\Redis-x64-3.2.100/redis-server.exe redis.windows.conf" start= auto displayname= "AutoStart Endv Redis"
sc create "Endv zookeeper" binPath= "cmd.exe /c start D:\zookeeper-3.5.2-alpha\bin/zkServer.cmd" start= auto displayname= "AutoStart Endv zookeeper"
sc create "Endv mpush" binPath= "cmd.exe /c start java -Dmp.conf=D:\mpush-0.7.1\conf\mpush.conf -jar bootstrap.jar" start= auto displayname= "AutoStart Endv mpush"
sc create "Endv mpush-alloc" binPath= "cmd.exe /c start java -Dmp.conf=D:\mpush-alloc-0.7.1\conf\mpush.conf -jar bootstrap.jar" start= auto displayname= "AutoStart Endv mpush-alloc"

以管理员身份运行,

上一篇:读书笔记—CLR via C#异常和状态管理


下一篇:必须知道的Linux内核常识详解