~~Title:Cobub Toaster **** - Mobile Apps Marketing Platform of Open Source - Mobile Analytics & Mobile Push Notification Solutions - Cobub Mobile Developer Center~~ {{description>Cobub Razor is an Open Source Mobile Analytics. Linux core parameters setting (not necessary for testing, must be done in an operation environment).}} {{keywords>Cobub Razor,open source mobile analytics,mobile analytics,mobile app analytics, pns, installation guide}} ====== Installation Guide of PNS ====== Linux core parameters setting (not necessary for testing, must be done in an operation environment) Modify /etc/sysctl.conf, add the following lines: fs.file-max = 600000 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_max_tw_buckets = 5000 net.ipv4.ip_local_port_range = 1024 61000 net.ipv4.tcp_rmem = 512 32768 262142 net.ipv4.tcp_wmem = 1024 32768 262142 net.core.netdev_max_backlog = 8096 net.core.rmem_default = 262144 net.core.wmem_default = 262144 net.core.rmem_max = 2097152 net.core.wmem_max = 2097152 net.ipv4.tcp_syncookies = 1 Save the file and execute “sysctl -p” command, which will need root authority. Please NOTE the parameter of fs.file-max, which means how many file handles can be opened globally. This number should be determined by expected persistent connections and server memory. The sample above is 600,000. Normally this figure needed to be set more than the wanted persistent connections number, as an example, if you’d like to maintain 500,000 persistent connections, it will be nice to set the number to 600,000. Modify /etc/security/limits.conf, append the following: USERNAME - nofile 600000 Change the first parameter parameter USERNAME to your username, keep the number here same with the fs.file-max parameter, 600,000 as example. Then logout and login remotely or restart Linux, and execute “ulimit -n”. If it shows 600,000, it means the configuration is working. If the parameters are not set, when the persistent connections number exceeds a certain number, the system will show errors something like: ulimit: open files: cannot modify limit: Operation not permitted or Too many open files in system ====== Install Cobub Toaster ====== Extract Cobub Toaster PNS package to any directory, like /usr/local/ or /opt/ Modify configuration file toaster.conf. Some configurations are explained as following: [base] # userMaxCount: this parameter is important, which is the max links number. If connections are more than this count, PNS server will return error "5000 server is busy" to client, the value here should be smaller than fs.file-max above. userMaxCount 500000 # bind: the network interface listened by PNS, with format of "IP:PORT". Please divide interfaces by "," if more than one. Usually it is enough to listen one network interface. tcp.bind 0.0.0.0:9000,0.0.0.0:9001 [web] # post body size limits, the default value is 10MB. You can set "1gb" if want 1GB. postlimit 10mb # bind: which network interface should be listened by Web Interface of PNS, format as IP:PORT. NOTE, "localhost" here should be replaced with their network address, like 192.168.xxx.xxx (it's recommended strongly that DON'T expose Web Interface to public network). It's also recommend to use Nginx as a reverse proxy, to avoid the garbage problem. bind 127.0.0.1:8888 [message] feedbackTimeout 20m # The max message expiration time is 720 hours (30 days) maxMsgExpire 720h [connection] #min heartbeat timeout, 1 minute min_heartbeart_timeout 1m #max heartbeat timeout, 20 minutes max_heartbeat_timeout 20m #If PNS doesn't receive the heartbeat during the interval of heartbeat+heartbeatDelay, it will treat the connection as dead link, and will close the connection, here set to 30 seconds. heartbeatDelay 30s [cobub_verify] #The two keys come form Cobub user center user_key 3e5f68afbb0f94xxx09bfc1730 user_secret 2d43d5dcdcb2yyyy3269dfb56b4b17 Redis Install & Configure tar zxvf redis-2.6.16.tar.gz cd redis-2.6.16 make sudo make install cd ~ mkdir redis-6379 cd redis-6379 nohup redis-server & ====== Start PNS ====== Confirm that redis is already running before starting the server. nohup ./toaster -log_dir="./log" & ====== View the PNS version ====== ./toaster -version