mpush 服務端配置html
如下安裝部分是參照官方的步驟,java
1、安裝jdk1.8並配置環境變量node
示例: http://www.cnblogs.com/endv/p/6439860.htmlgit
2、Windows安裝Redisgithub
下載地址Github (https://github.com/MSOpenTech/redis/releases),redis
Redis-x64-3.2.100.zip apache
1.下載並解壓,解壓後以下bootstrap
2.使用cmd進入到Redis解壓目錄中,並使用腳本(redis-server.exe redis.windows.conf)執行便可,默認配置文件不須要修改windows
Microsoft Windows [版本 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\Redis-x64-3.2.100 D:\Redis-x64-3.2.100>redis-server.exe redis.windows.conf _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 12096 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [12096] 25 Feb 20:40:09.347 # Server started, Redis version 3.2.100 [12096] 25 Feb 20:40:09.347 * The server is now ready to accept connections on port 6379
3、 Windows安裝Zookeeperapi
從官網直接下載Zookeeper最新版本(Zookeeper支持Windows和Linux)
1.下載並解壓,解壓後以下
2.提供配置文件
將conf目錄下的zoo_sample.conf重命名爲zoo.conf
3.到bin目錄下,雙擊zkServer.bat便可
Microsoft Windows [版本 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\zookeeper-3.5.2-alpha\bin D:\zookeeper-3.5.2-alpha\bin>zkServer.cmd
Microsoft Windows [版本 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\zookeeper-3.5.2-alpha\bin D:\zookeeper-3.5.2-alpha\bin>zkServer.cmd D:\zookeeper-3.5.2-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" 2017-02-25 20:50:06,765 [myid:] - INFO [main:QuorumPeerConfig@116] - Reading configuration from: D:\zookeeper-3.5.2-alpha\bin\..\conf\zoo.cfg 2017-02-25 20:50:06,781 [myid:] - WARN [main:VerifyingFileFactory@59] - \tmp\zookeeper is relative. Prepend .\ to indicate that you're sure! 2017-02-25 20:50:06,874 [myid:] - INFO [main:QuorumPeerConfig@318] - clientPortAddress is 0.0.0.0/0.0.0.0:2181 2017-02-25 20:50:06,874 [myid:] - INFO [main:QuorumPeerConfig@322] - secureClientPort is not set 2017-02-25 20:50:06,874 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3 2017-02-25 20:50:06,874 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0 2017-02-25 20:50:06,874 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled. 2017-02-25 20:50:06,874 [myid:] - WARN [main:QuorumPeerMain@122] - Either no config or no quorum defined in config, running in standalone mode 2017-02-25 20:50:06,874 [myid:] - INFO [main:ManagedUtil@46] - Log4j found with jmx enabled. 2017-02-25 20:50:07,420 [myid:] - INFO [main:QuorumPeerConfig@116] - Reading configuration from: D:\zookeeper-3.5.2-alpha\bin\..\conf\zoo.cfg 2017-02-25 20:50:07,421 [myid:] - WARN [main:VerifyingFileFactory@59] - \tmp\zookeeper is relative. Prepend .\ to indicate that you're sure! 2017-02-25 20:50:07,424 [myid:] - INFO [main:QuorumPeerConfig@318] - clientPortAddress is 0.0.0.0/0.0.0.0:2181 2017-02-25 20:50:07,424 [myid:] - INFO [main:QuorumPeerConfig@322] - secureClientPort is not set 2017-02-25 20:50:07,430 [myid:] - INFO [main:ZooKeeperServerMain@113] - Starting server 2017-02-25 20:50:07,480 [myid:] - INFO [main:Environment@109] - Server environment:zookeeper.version=3.5.2-alpha-1750793, built on 06/30/2016 13:15 GMT 2017-02-25 20:50:07,481 [myid:] - INFO [main:Environment@109] - Server environment:host.name=DESKTOP-3ML7R0C 2017-02-25 20:50:07,483 [myid:] - INFO [main:Environment@109] - Server environment:java.version=1.8.0_121 2017-02-25 20:50:07,485 [myid:] - INFO [main:Environment@109] - Server environment:java.vendor=Oracle Corporation 2017-02-25 20:50:07,489 [myid:] - INFO [main:Environment@109] - Server environment:java.home=C:\Program Files\Java\jdk1.8.0_121\jre 2017-02-25 20:50:07,493 [myid:] - INFO [main:Environment@109] - Server environment:java.class.path=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\..\zookeeper-3.5.2-alpha.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\commons-cli-1.2.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\jackson-core-asl-1.9.11.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\jackson-mapper-asl-1.9.11.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\javacc.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\jetty-6.1.26.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\jetty-util-6.1.26.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\jline-2.11.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\log4j-1.2.17.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\netty-3.10.5.Final.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\servlet-api-2.5-20081211.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\slf4j-api-1.7.5.jar;D:\zookeeper-3.5.2-alpha\bin\..\lib\slf4j-log4j12-1.7.5.jar;D:\zookeeper-3.5.2-alpha\bin\..\conf 2017-02-25 20:50:07,498 [myid:] - INFO [main:Environment@109] - Server environment:java.library.path=C:\Program Files\Java\jdk1.8.0_121\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.8.0_121\Bin;C:\Program Files\Java\jdk1.8.0_121\jre\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;. 2017-02-25 20:50:07,506 [myid:] - INFO [main:Environment@109] - Server environment:java.io.tmpdir=C:\Users\endv\AppData\Local\Temp\ 2017-02-25 20:50:07,509 [myid:] - INFO [main:Environment@109] - Server environment:java.compiler=<NA> 2017-02-25 20:50:07,513 [myid:] - INFO [main:Environment@109] - Server environment:os.name=Windows 10 2017-02-25 20:50:07,517 [myid:] - INFO [main:Environment@109] - Server environment:os.arch=amd64 2017-02-25 20:50:07,521 [myid:] - INFO [main:Environment@109] - Server environment:os.version=10.0 2017-02-25 20:50:07,525 [myid:] - INFO [main:Environment@109] - Server environment:user.name=endv 2017-02-25 20:50:07,529 [myid:] - INFO [main:Environment@109] - Server environment:user.home=C:\Users\endv 2017-02-25 20:50:07,533 [myid:] - INFO [main:Environment@109] - Server environment:user.dir=D:\zookeeper-3.5.2-alpha\bin 2017-02-25 20:50:07,537 [myid:] - INFO [main:Environment@109] - Server environment:os.memory.free=116MB 2017-02-25 20:50:07,541 [myid:] - INFO [main:Environment@109] - Server environment:os.memory.max=1803MB 2017-02-25 20:50:07,544 [myid:] - INFO [main:Environment@109] - Server environment:os.memory.total=123MB 2017-02-25 20:50:07,552 [myid:] - INFO [main:ZooKeeperServer@858] - minSessionTimeout set to 4000 2017-02-25 20:50:07,553 [myid:] - INFO [main:ZooKeeperServer@867] - maxSessionTimeout set to 40000 2017-02-25 20:50:07,556 [myid:] - INFO [main:ZooKeeperServer@156] - Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir \tmp\zookeeper\version-2 snapdir \tmp\zookeeper\version-2 2017-02-25 20:50:07,622 [myid:] - INFO [main:Slf4jLog@67] - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog 2017-02-25 20:50:07,665 [myid:] - INFO [main:Slf4jLog@67] - jetty-6.1.26 2017-02-25 20:50:07,913 [myid:] - INFO [main:Slf4jLog@67] - Started SelectChannelConnector@0.0.0.0:8080 2017-02-25 20:50:07,923 [myid:] - INFO [main:JettyAdminServer@105] - Started AdminServer on address 0.0.0.0, port 8080 and command URL /commands 2017-02-25 20:50:07,953 [myid:] - INFO [main:NIOServerCnxnFactory@673] - Configuring NIO connection handler with 10s sessionless connection timeout, 2 selector thread(s), 16 worker threads, and 64 kB direct buffers. 2017-02-25 20:50:07,957 [myid:] - INFO [main:NIOServerCnxnFactory@686] - binding to port 0.0.0.0/0.0.0.0:2181 2017-02-25 20:50:08,012 [myid:] - INFO [main:FileTxnSnapLog@298] - Snapshotting: 0x0 to \tmp\zookeeper\version-2\snapshot.0 2017-02-25 20:50:08,053 [myid:] - INFO [main:ContainerManager@64] - Using checkIntervalMs=60000 maxPerMinute=10000
4、安裝mpush
1.解壓mpush-release-0.7.1.tar.gz
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.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-0.7.1\bin D:\mpush-0.7.1\bin>java -Dmp.conf=D:\mpush-0.7.1\conf\mpush.conf -jar bootstrap.jar
Microsoft Windows [版本 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-0.7.1\bin D:\mpush-0.7.1\bin>java -Dmp.conf=D:\mpush-0.7.1\conf\mpush.conf -jar bootstrap.jar 21:07:05.468 - { "conf" : "D:\\mpush-0.7.1\\conf\\mpush.conf", "core" : { "compress-threshold" : "10k", "epoll-provider" : "netty", "max-hb-timeout-times" : 2, "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" : 5, "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" : 3002, "connect-server-port" : 3000, "gateway-client-multicast" : "239.239.239.99", "gateway-client-num" : 1, "gateway-client-port" : 4000, "gateway-server-multicast" : "239.239.239.88", "gateway-server-net" : "tcp", "gateway-server-port" : 3001, "public-host-mapping" : {}, "rcv_buf" : { "connect-server" : "32k", "gateway-client" : 0, "gateway-server" : 0 }, "snd_buf" : { "connect-server" : "32k", "gateway-client" : 0, "gateway-server" : 0 }, "traffic-shaping" : { "connect-server" : { "check-interval" : "100ms", "enabled" : false, "read-channel-limit" : "3k", "read-global-limit" : "100k", "write-channel-limit" : "3k", "write-global-limit" : 0 }, "gateway-client" : { "check-interval" : "100ms", "enabled" : false, "read-channel-limit" : 0, "read-global-limit" : 0, "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" : 0, "write-global-limit" : 0 } }, "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" : 0 }, "push" : { "flow-control" : { "broadcast" : { "duration" : "1s", "limit" : 3000, "max" : 100000 }, "global" : { "duration" : "1s", "limit" : 5000, "max" : 0 } } }, "redis" : { "cluster-model" : "single", "config" : { "blockWhenExhausted" : true, "fairness" : false, "jmxEnabled" : false, "jmxNameBase" : "pool", "jmxNamePrefix" : "pool", "lifo" : true, "maxIdle" : 4, "maxTotal" : 8, "maxWaitMillis" : 5000, "minEvictableIdleTimeMillis" : 300000, "minIdle" : 1, "numTestsPerEvictionRun" : 3, "softMinEvictableIdleTimeMillis" : 1800000, "testOnBorrow" : false, "testOnCreate" : false, "testOnReturn" : false, "testWhileIdle" : false, "timeBetweenEvictionRunsMillis" : 60000 }, "nodes" : [ "127.0.0.1:6379" ], "password" : "", "write-to-zk" : false }, "security" : { "aes-key-length" : 16, "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" : 1, "conn-work" : 0, "event-bus" : { "max" : 16, "min" : 1, "queue-size" : 10000 }, "gateway-client-work" : 0, "gateway-server-work" : 0, "http-work" : 0, "mq" : { "max" : 4, "min" : 1, "queue-size" : 10000 }, "push-client" : 2, "push-task" : 0 } }, "zk" : { "connectionTimeoutMs" : "5s", "digest" : "mpush", "namespace" : "mpush", "retry" : { "baseSleepTimeMs" : "3s", "maxRetries" : 3, "maxSleepMs" : "5s" }, "server-address" : "127.0.0.1:2181", "sessionTimeoutMs" : "5s", "watch-path" : "/" } } 21:07:05.548 - launch mpush server... 21:07:05.749 - bootstrap chain starting... 21:07:05.750 - start bootstrap job [CacheManagerBoot] 21:07:05.958 - start bootstrap job [ServiceRegistryBoot] 21:07:05.958 - init service registry waiting for connected... 21:07:06.508 - start bootstrap job [ServerBoot(ConnectionServer)] 21:07:07.100 - start ConnectionServer success on:3000 21:07:07.317 - start bootstrap job [ServerBoot(GatewayServer)] 21:07:07.363 - start GatewayServer success on:3001 21:07:07.517 - start bootstrap job [ServerBoot(AdminServer)] 21:07:07.571 - start AdminServer success on:3002 21:07:07.572 - start bootstrap job [PushCenterBoot] 21:07:07.663 - start bootstrap job [HttpProxyBoot] 21:07:07.680 - start bootstrap job [MonitorBoot] 21:07:07.681 - start bootstrap job [LastBoot] 21:07:07.761 - bootstrap chain started. 21:07:07.761 - =================================================================== 21:07:07.762 - ====================MPUSH SERVER START SUCCESS===================== 21:07:07.766 - ===================================================================
5、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.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-alloc-0.7.1\bin D:\mpush-alloc-0.7.1\bin>java -Dmp.conf=D:\mpush-alloc-0.7.1\conf\mpush.conf -jar bootstrap.jar
Microsoft Windows [版本 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\endv>d: D:\>cd D:\mpush-alloc-0.7.1\bin D:\mpush-alloc-0.7.1\bin>java -Dmp.conf=D:\mpush-alloc-0.7.1\conf\mpush.conf -jar bootstrap.jar 21:13:42.425 - { "conf" : "D:\\mpush-alloc-0.7.1\\conf\\mpush.conf", "core" : { "compress-threshold" : "10k", "epoll-provider" : "netty", "max-hb-timeout-times" : 2, "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" : 5, "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" : 3002, "alloc-server-port" : 9999, "connect-server-port" : 3000, "gateway-client-multicast" : "239.239.239.99", "gateway-client-num" : 1, "gateway-client-port" : 4000, "gateway-server-multicast" : "239.239.239.88", "gateway-server-net" : "tcp", "gateway-server-port" : 3001, "public-host-mapping" : {}, "rcv_buf" : { "connect-server" : "32k", "gateway-client" : 0, "gateway-server" : 0 }, "snd_buf" : { "connect-server" : "32k", "gateway-client" : 0, "gateway-server" : 0 }, "traffic-shaping" : { "connect-server" : { "check-interval" : "100ms", "enabled" : false, "read-channel-limit" : "3k", "read-global-limit" : "100k", "write-channel-limit" : "3k", "write-global-limit" : 0 }, "gateway-client" : { "check-interval" : "100ms", "enabled" : false, "read-channel-limit" : 0, "read-global-limit" : 0, "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" : 0, "write-global-limit" : 0 } }, "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" : 0 }, "push" : { "flow-control" : { "broadcast" : { "duration" : "1s", "limit" : 3000, "max" : 100000 }, "global" : { "duration" : "1s", "limit" : 5000, "max" : 0 } } }, "redis" : { "cluster-model" : "single", "config" : { "blockWhenExhausted" : true, "fairness" : false, "jmxEnabled" : false, "jmxNameBase" : "pool", "jmxNamePrefix" : "pool", "lifo" : true, "maxIdle" : 4, "maxTotal" : 8, "maxWaitMillis" : 5000, "minEvictableIdleTimeMillis" : 300000, "minIdle" : 1, "numTestsPerEvictionRun" : 3, "softMinEvictableIdleTimeMillis" : 1800000, "testOnBorrow" : false, "testOnCreate" : false, "testOnReturn" : false, "testWhileIdle" : false, "timeBetweenEvictionRunsMillis" : 60000 }, "nodes" : [ "127.0.0.1:6379" ], "password" : "", "write-to-zk" : false }, "security" : { "aes-key-length" : 16, "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" : 1, "conn-work" : 0, "event-bus" : { "max" : 16, "min" : 1, "queue-size" : 10000 }, "gateway-client-work" : 0, "gateway-server-work" : 0, "http-work" : 0, "mq" : { "max" : 4, "min" : 1, "queue-size" : 10000 }, "push-client" : 2, "push-task" : 0 } }, "zk" : { "connectionTimeoutMs" : "5s", "digest" : "mpush", "namespace" : "mpush", "retry" : { "baseSleepTimeMs" : "3s", "maxRetries" : 3, "maxSleepMs" : "5s" }, "server-address" : "127.0.0.1:2181", "sessionTimeoutMs" : "5s", "watch-path" : "/" } } 21:13:42.456 - launch alloc server... 21:13:43.322 - =================================================================== 21:13:43.322 - ====================ALLOC SERVER START SUCCESS===================== 21:13:43.322 - ===================================================================
6、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
正常狀況,客戶端會受到由服務器端推送過來的消息
二、模擬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
手機瀏覽:
輸入手機端設置的用戶ID(from位置),輸入推送消息,點擊send便可
手機端提示消息
7、註冊 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"
以管理員身份運行,