Skip to content
Yaming edited this page Aug 28, 2015 · 16 revisions

Welcome to the QPush wiki!

一、运行环境

1.创建运行用户(如jetty), 得到运行目录(记为 $RUN_FOLDER )/home/jetty

2.配置参数(/etc/security/limits.conf)

* soft nofile 65535
* hard nofile 65535

3.配置参数(/etc/sysctl.conf)

vm.swappiness = 0
vm.overcommit_memory = 1
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.all.arp_announce=2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv4.conf.lo.arp_announce=2

fs.file-max = 1048576
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_mem = 786432 2097152 3145728
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
 
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000

4.安装Redis

https://github.com/antirez/redis

5.安装MySQL

http://www.cnblogs.com/shanyou/p/3278692.html
http://www.tuicool.com/articles/m6r6Bjj

二、部署

1.下载并准备好源码

su - jetty
mkdir -p source
cd source
git clone https://github.com/yamingd/QPush.git
cp -f Deploy/qpush.zip ../
cp -f Deploy/deploy_qpush.sh ../
cd ../
unzip -o qpush.zip
chmod +x deploy_qpush.sh

2.若系统没有安装gradle (http://gradle.org/)

cd ~/source/QPush
./gradlew build

这个时候会看到下载gradle的进度,等待下载完成和上面的命令执行完成.

接下来需要配置gradle到.bash_profile,方便全局使用

PATH=$PATH:$HOME/bin:$HOME/gradle-2.5/bin
export PATH

当然上面也可以直接到http://gradle.org/下载安装包到$HOME,然后解压出来,只要把正确的gradle目录配置到$PATH里即可

3.配置QPush参数 3.1 Redis参数($HOME/qpush/conf/jedis.properties)

host=127.0.0.1
port=63790
maxActive=50
maxIdle=10
maxWait=5000

根据自己的环境修改host, port, maxWait, MaxActive, maxIdel

3.2 MySQL参数($HOME/qpush/conf/jdbc.properties)

driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://127.0.0.1:33060/qpush?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&rewriteBatchedStatements=true
username=qpush
password=qpush!
idleConnectionTestPeriod=60
idleMaxAge=240
maxConnectionsPerPartition=30
minConnectionsPerPartition=10
partitionCount=3
acquireIncrement=10
statementsCacheSize=100
releaseHelperThreads=3

根据自己的参数修改jdbcUrl, username, password。同时请参考jdbc组件的官网(http://www.jolbox.com/)来强化配置

Clone this wiki locally