以下安装部分是参照官方的步骤,
示例: http://www.cnblogs.com/endv/p/6439860.html
二、Windows安装Redis
下载地址Github (https://github.com/MSOpenTech/redis/releases),
Redis-x64-3.2.100.zip
1.下载并解压,解压后如下
2.使用cmd进入到Redis解压目录中,并使用脚本(redis-server.exe redis.windows.conf)执行即可,默认配置文件不需要修改
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
从官网直接下载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
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
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
四、安装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
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
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 - ===================================================================
五、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
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
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 - ===================================================================
六、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
手机浏览:
输入手机端设置的用户ID(from位置),输入推送消息,点击send即可
手机端提示消息
七、注册 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"
以管理员身份运行,