TypeSdkServer Manual Installation Deployment

Keywords: Redis Nginx RPM MySQL

The following example server operating system uses: Centos7.2-X8.6_64_Lite

Software usage: Mysql 5.6; Nginx 1.8.1; Nodejs 6.9.5; Redis 3.2.3

Code and related environments can be downloaded here

https://code.csdn.net/typesdk_code/typesdk_server/tree/master

1. After installing Centos7.x, install Git and clone related programs directly from the source library.

1. Installing git

yum install -y git
2, Cloning code from git

git clone https://code.csdn.net/typesdk_code/typesdk_server.git

2. Install Mysql and import the database (root user only logs in locally, not open remote, password is typesdk.com)

1. Install MySQL 5.6, using official source

cdtypesdk_server/Tools/
rpm -ivhmysql57-community-release-el7-9.noarch.rpm
cpmysql-community.repo /etc/yum.repos.d/mysql-community.repo
yum install -ymysql-server
mkdir -p/data/typesdk_server/mysql_data
chown -R mysql.mysql/data/typesdk_server/mysql_data
cp /etc/my.cnf/etc/my.cnf.bak
>/etc/my.cnf
vi /etc/my.cnf
Following is the full text of the configuration file, which is copied directly into it.

[mysqld]
datadir=/data/typesdk_server/mysql_data
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

2. Start the database

service mysql start

3. Importing database

mysql <../SdkServer_free_git/typesdk_server.sql
mysqladmin-u root password "typesdk.com"

3. Install redis and import data (redis only logs in locally, not remotely, password is typesdk.com)

1. Using RPM to install redis

rpm -ivhjemalloc-3.6.0-1.el7.x86_64.rpm
rpm -ivhredis-3.2.3-1.el7.x86_64.rpm
mkdir -p /data/typesdk_server/redis_data
chown -R redis.redis/data/typesdk_server/redis_data
cp /etc/redis.conf /etc/redis.conf.bak
>/etc/redis.conf
vi /etc/redis.conf

Following is the full text of the configuration file, which is copied directly into it.

bind127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /var/log/redis/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename sdk.rdb
dir /data/typesdk_server/redis_data
slave-serve-stale-data yes
slave-read-only yes
requirepass typesdk.com
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename"appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb64mb 60
client-output-buffer-limit pubsub 32mb8mb 60
hz 10
aof-rewrite-incremental-fsync yes

2. Start redis.

service redis start

3. Import redis database

sh../SdkServer_free_git/init_redis.sh

Special attention should be paid to the correct configuration of redis in init_redis.sh. apikey is the key of communication between sdk server and game server. Please modify it to be consistent according to the actual situation. See the script notes for other channel parameters.

There is a graphical configuration tool in the TypeSdk packaging tool, which can also be used for post-generation synchronization.

IV. Installation and configuration of nginx

1. rpm installation nginx

rpm -ivhnginx-1.8.1-1.el7.ngx.x86_64.rpm
mkdir -p/data/typesdk_server/nginx_html/config
cp/etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
mkdir -p/data/typesdk_server/nginx_html/config/
cp -rfNginx_SwitchConfig/1001/ /data/typesdk_server/nginx_html/config/
>/etc/nginx/nginx.conf
vi/etc/nginx/nginx.conf

Following is the full text of the configuration file, which is copied directly into it.

#user nobody;
worker_processes  auto;
events {
   worker_connections  102400;
}
http {
   include       mime.types;
   default_type application/octet-stream;
   sendfile        on;
   keepalive_timeout  65;
   gzip  on;
   server {
       listen       80;
       #server_name  your.domain.name;
       location /config {
            root   /data/typesdk_server/nginx_html;
            index  index.html index.htm;
       }
       location / {
            proxy_pass http://127.0.0.1:40000;
       }   
           location/getIp {
       default_type application/json;
       return 200 '{"ip":"$remote_addr"}';
           }
       error_page   500 502 503 504  /50x.html;
       location = /50x.html {
            root   html;
       }
   }
} 

2. Start nginx

service nginx start

5. Install node environment and configure TypeSdkServer

1. rpm installation node

rpm -ivh nodejs-6.9.5-1nodesource.el7.centos.x86_64.rpm
npm config set registry http://registry.cnpmjs.org
cp -rf ../SdkServer_free_git/ /data/typesdk_server/
chmod +x /data/typesdk_server/SdkServer_free_git/node_modules/pm2/bin/pm2
ln -s /data/typesdk_server/SdkServer_free_git/node_modules/pm2/bin/pm2/usr/bin/pm2

Pay special attention to the / data/typesdk_server/SdkServer_free_git/config.json file

Please modify it according to the configuration of mysql and redis installed. If you use the above configuration directly, you do not need to modify it.

2. Start TypeSdkServer

cd/data/typesdk_server/SdkServer_free_git/bin/
pm2 start www

6. Check whether the installation is complete

Open the browser to access the following interfaces

http://IP/1001/3/Login

http://IP/1001/3/Pay

The above two interfaces will appear json

http://192.168.206.19/config/1001/3/config.txt

You can read the configuration file above.

http://IP/getIp

Above, you can get the client IP address.

The normal appearance of servers indicates that the server has been deployed.

Posted by eternalprophet on Thu, 18 Apr 2019 03:15:33 -0700