搭建配置SSDB

測試環境
# cat /etc/redhat-release
CentOS release 6.4 (Final)
1.1 必備軟件
yum install –y wget unzip gcc gcc-c++
1.2 下載安裝
wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
unzip master
cd ssdb-master
make
# optional, install ssdb in /usr/local/ssdb
sudo make install
1.3 啓動
# start master
./ssdb-server ssdb.conf

# or start as daemon
./ssdb-server -d ssdb.conf

# ssdb command line
./tools/ssdb-cli -p 8888

# stop ssdb-server
kill `cat ./var/ssdb.pid`

1.4 製作啓動腳本
copy tools/ssdb.sh /etc/init.d/ssdb
vim /etc/init.d/init.d/ssdb.conf    #修改配置文件路徑
---------------------------------------------------
# ssdb      Start ssdb
#
# chkconfig: 2345 08 92
# description:  Starts, stops and saves tomcat
#
# config: /usr/local/ssdb/ssdb.conf
#
### BEGIN INIT INFO
# Provides: ssdb
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop ssdb
# Description: Start, stop and save ssdb
### END INIT INFO
configs=/usr/local/ssdb/ssdb.conf
---------------------------------------------------

#設置開機自啓動
chkconfig --add ssdb
chkconfig ssdb on

1.5 設置環境變量
vim /etc/profile
--------------------------------------------------
SSDB_HOME=/usr/local/ssdb
PATH=$SSDB_HOME:$PATH
export SSDB_HOME PATH
--------------------------------------------------
source /etc/profile

1.6 SSDB主從複製


主:
# cat /usr/local/ssdb/ssdb.conf
server:
    ip: 192.168.16.202            #修改
    port: 8888                #修改
    # bind to public ip
    #ip: 0.0.0.0
    # format: allow|deny: all|ip_prefix
    # multiple allows or denys is supported
    #deny: all
    allow: 127.0.0.1            #修改
    allow: 192.168                #修改
從:
# cat /usr/local/ssdb/ssdb.conf
server:
    ip: 192.168.16.201        #修改
    port: 8888            #修改
    # bind to public ip
    #ip: 0.0.0.0
    # format: allow|deny: all|ip_prefix
    # multiple allows or denys is supported
    #deny: all
    allow: 127.0.0.1        #修改
    allow: 192.168            #修改
replication:
    binlog: yes
    # Limit sync speed to *MB/s, -1: no limit
    sync_speed: -1
    slaveof:
        # to identify a master even if it moved(ip, port changed)
        # if set to empty or not defined, ip:port will be used.
        id: svc_2            #修改
        # sync|mirror, default is sync
        type: sync            #修改
        ip: 192.168.16.202        #修改
        port: 8888            #修改
主從:
#./ssdb-server -d ssdb.conf

# /etc/init.d/ssdb restart

主從:
# /usr/local/ssdb/ssdb-cli -h 192.168.16.201 -p 8888
# /usr/local/ssdb/ssdb-cli -h 192.168.16.202 -p 8888



1.6 修改jar包啓動腳本
-Dapplication.ssdb.master.host=192.168.16.202 -Dapplication.ssdb.master.port=8888 -Dapplication.ssdb.slave.host=192.168.16.201 -Dapplication.ssdb.slave.port=8888


參考:
http://ssdb.io/docs/install.html
http://ssdb.io/docs/config.html
https://github.com/ssdb/phpssdbadmin

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章