centos下的ssdb的安装和使用

前端之家收集整理的这篇文章主要介绍了centos下的ssdb的安装和使用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

简介

SSDB一个高性能支持丰富数据结构的 Nosql 数据库,用于替代 Redis.

功能比较

  • redis是基于内存的,SSDB 是基于文件系统的。使用的是Google LevelDB作为存储引擎,支持T级别的数据,同时支持类似Redis中的zset和hash等数据结构,在同时需求高性能和大数据的条件下,作为Redis的补充还是可以的。
  • SSDB 利用了LevelDB 的高性能存储实现,但是LevelDB 是一个对于顺序读写非常友好的数据库实现,但是对于随机读的性能会比较糟糕。因此,SSDB 在面向随机的键值读取上会比较糟糕,它更适合一些批量读写操作,如监控数据的存储,队列数据,不需要实时处理的数据等等。

安装

  1. install SSDB
wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
    unzip master.zip
    cd ssdb-master
    make
    make install
 # 安装到 opt 目录  make install PREFIX=/opt

服务配置

  1. 设置为服务
    代码 tools 目录下 ssdb.sh 拷贝到 /etc
cp tools/ssdb.sh /etc/init.d/ssdb
需要注意的是配置文件configs路径,文件如下:

```

#!/bin/sh

chkconfig: 2345 64 36

description: SSDB startup scripts

ssdb_root=/usr/local/ssdb ssdb_bin=$ssdb_root/ssdb-server

each config file for one instance

configs="/data/ssdb_data/test/ssdb.conf /data/ssdb_data/test2/ssdb.conf"

configs="/usr/local/ssdb/ssdb.conf" if [ -f /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions fi start() { for conf in $configs; do $ssdb_bin $conf -s restart -d done } stop() { for conf in $configs; do $ssdb_bin $conf -s stop -d done }

See how we were called.

case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" ;; esac exit $RETVAL

2. 默认配置文件 (/usr/local/ssdb/ssdb.conf)

    ``` 
# ssdb-server config
# MUST indent by TAB!
# relative to path of this file,directory must exists
work_dir = ./var
pidfile = ./var/ssdb.pid
server:
        ip: 127.0.0.1
        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
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 KB
        block_size: 32
        # in MB
        write_buffer_size: 64
        # in MB/s
        compaction_speed: 1000
        # yes|no
        compression: yes
  1. 设置开机启动
chkconfig --add ssdb
    chkconfig ssdb on #设置开机启动
    service ssdb restart # 重启服务

基本使用

待续

扩展阅读

原文链接:https://www.f2er.com/centos/380514.html

猜你在找的CentOS相关文章