您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
SSDB简介
SSDB 是一个 C/C++ 语言开发的高性能 NoSQL 数据库, 支持 KV, list, map(hash), zset(sorted set) 等数据结构, 用来替代或者与 Redis 配合存储十亿级别列表的数据.
SSDB 是稳定的, 生产环境使用的, 已经在许多互联网公司得到广泛使用, 如奇虎 360, TOPGAME.
下载和安装
wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip unzip master cd ssdb-master make # 将安装在 /usr/local/ssdb 目录下 sudo make install
# 启动主库, 此命令会阻塞住命令行 ./ssdb-server ssdb.conf # 或者启动为后台进程(不阻塞命令行) ./ssdb-server -d ssdb.conf # 停止 ssdb-server ./ssdb-server ssdb.conf -s stop # 对于旧版本 kill `cat ./var/ssdb.pid` # 重启 ./ssdb-server ssdb.conf -s restart
双主方案
master-1:10.105.10.77
work_dir = ./var pidfile = ./var/ssdb.pid server: ip: 0.0.0.0 port: 8888 replication: binlog: yes sync_speed: -1 slaveof: id: svc_2 type: sync host: 10.105.10.128 port: 8888 logger: level: info output: log.txt rotate: size: 1000000000 leveldb: cache_size: 500 block_size: 32 write_buffer_size: 64 compaction_speed: 1000 compression: yes
重启ssdb
master-2:10.105.10.128
work_dir = ./var pidfile = ./var/ssdb.pid server: ip: 0.0.0.0 port: 8888 replication: binlog: yes sync_speed: -1 slaveof: id: svc_2 type: sync host: 10.105.10.77 port: 8888 logger: level: info output: log.txt rotate: size: 1000000000 leveldb: cache_size: 500 block_size: 32 write_buffer_size: 64 compaction_speed: 1000 compression: yes
重启SSDB
安装配置haproxy
yum -y install haproxy vim /etc/haproxy/haproxy.cfg
global log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats defaults mode http log global option dontlognull option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 listen test bind 0.0.0.0:8899 mode tcp balance roundrobin server s1 10.105.10.128:8888 weight 1 maxconn 10000 check inter 10s server s2 10.105.10.77:8888 weight 1 maxconn 10000 check inter 10s
重新启动haproxy,以后可以利用keepalive 将haproxy设计成双主或准备都可以
/etc/init.d/haproxy restart
测试(客户端连接haproxy地址)
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。