zoukankan      html  css  js  c++  java
  • ssdb 主从安装及配置

    IP:
    192.168.56.11 主
    192.168.56.12 从

    1、#下载安装包
    wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
    unzip master.zip
    [root@node2 src]# cd ssdb-master/
    [root@node2 ssdb-master]# make

    默认安装在 /usr/local/ssdb 目录下

    [root@node2 ssdb-master]# make install

    2、修改启动脚本

    [root@node2 ssdb-master]# cp tools/ssdb.sh /etc/init.d/ssdb

    [root@node2 ssdb-master]# vim /etc/init.d/ssdb
    configs="/usr/local/ssdb/ssdb.conf"

    3、加入启动项

    [root@node2 src]# chkconfig --add ssdb
    [root@node2 src]# chkconfig ssdb on
    [root@node2 src]# chkconfig --list ssdb
    ssdb 0:off 1:off 2:on 3:on 4:on 5:on 6:off

    4、配置命令路径

    vim /etc/profile

    PATH=$PATH:/usr/local/ssdb
    export PATH

    source /etc/profile

    5.修改配置文件

    master:

    [root@linux-node1 ssdb]# cat ssdb.conf
    ssdb-server config
    MUST indent by TAB!

    absolute path, or relative to path of this file, directory must exists
    work_dir = ./var
    pidfile = ./var/ssdb.pid

    server:
    ip: 192.168.56.11
    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
    # auth password must be at least 32 characters
    #auth: very-strong-password
    #readonly: yes
    # in ms, to log slowlog with WARN level
    #slowlog_timeout: 5

    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
    #host: localhost
    #port: 8889

    logger:
    level: debug
    output: log.txt
    rotate:
    size: 1000000000

    leveldb:
    # in MB
    cache_size: 500
    # in MB
    write_buffer_size: 64
    # in MB/s
    compaction_speed: 1000
    # yes|no
    compression: yes

    [root@linux-node1 ssdb]#

    ++++++++++++++++++++++++++++++++++++++++++++++++++
    slave :

    [root@linux-node2 ssdb]# cat ssdb.conf
    ssdb-server config
    MUST indent by TAB!

    absolute path, or relative to path of this file, directory must exists
    work_dir = ./var
    pidfile = ./var/ssdb.pid

    server:
    ip: 192.168.56.12
    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
    # auth password must be at least 32 characters
    #auth: very-strong-password
    #readonly: yes
    # in ms, to log slowlog with WARN level
    #slowlog_timeout: 5

    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: node-1 #配置主服务器id
    # sync|mirror, default is sync
    type: sync #同步方式
    host: 192.168.56.11 #主机ip
    port: 8888 #端口

    logger:
    level: debug
    output: log.txt
    rotate:
    size: 1000000000

    leveldb:
    # in MB
    cache_size: 500
    # in MB
    write_buffer_size: 64
    # in MB/s
    compaction_speed: 1000
    # yes|no
    compression: yes

    [root@linux-node2 ssdb]#

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    6、登陆测试
    master:
    [root@linux-node1 ssdb]# ./ssdb-cli 192.168.56.11 -p8888
    ssdb (cli) - ssdb command line tool.
    Copyright (c) 2012-2016 ssdb.io

    'h' or 'help' for help, 'q' to quit.

    ssdb-server 1.9.6

    ssdb 192.168.56.11:8888> set name tom
    ok
    (0.001 sec)
    ssdb 192.168.56.11:8888> set age 18
    ok
    (0.001 sec)
    ssdb 192.168.56.11:8888> get name
    tom
    (0.000 sec)
    ssdb 192.168.56.11:8888> get age
    18
    (0.001 sec)
    ssdb 192.168.56.11:8888>

    slave:
    [root@linux-node2 ssdb]# ./ssdb-cli 192.168.56.12 -p8888
    ssdb (cli) - ssdb command line tool.
    Copyright (c) 2012-2016 ssdb.io

    'h' or 'help' for help, 'q' to quit.

    ssdb-server 1.9.6

    ssdb 192.168.56.12:8888> get name
    tom
    (0.001 sec)
    ssdb 192.168.56.12:8888> get age
    18
    (0.000 sec)
    ssdb 192.168.56.12:8888>

  • 相关阅读:
    计算机操作系统实验之_进程观测_实验报告
    KVO(NSKeyValueObserving 键 值编码)与KVC(NSKeyValueCoding 键值观察机制)详解
    用arrayWithObject:初始化,参数为空数组NSArray时出现的异常
    用QtCreator实现可扩展对话框实验
    xcode4 设置调试错误信息小结
    从“Qt信号槽机制”到”iOS(MVC)中的Target——Action机制”
    Qt源码分析之信号和槽机制
    objectivec 学习之NSMutableDictionary介绍
    iOS面试题汇总 (1)
    报告论文:关于一个小型学生信息管理系统研究
  • 原文地址:https://www.cnblogs.com/fengmeng1030/p/9225068.html
Copyright © 2011-2022 走看看