SSDB installation Deployment and Considerations Summary

Source: Internet
Author: User
Tags data structures documentation redis

SSDB is a high-performance NoSQL database developed by C + + language, supporting data structures such as Key-value, Key-hashmap, Key-zset (sorted set), which is ideal for storing hundreds of millions of-level lists, sorting tables and other collection data, which is Red is replacement and enhancement scenarios.

SSDB has a similar API to Redis, supporting clients including: PHP, C + +, Python, Java, Lua, Ruby,nodejs, etc.

SSDB is stable, the production environment used, has been widely used in many internet companies, such as 360, Topgame.

Objective:

This article records the steps I installed and tested, summarizes the documentation for IDEAWU and makes it easy to use later.

The SSDB configuration file uses a TAB to indicate indentation, no spaces, and no one. Default configuration reference: Ssdb.conf.

SSDB supports primary master, master-slave deployment, and after starting a background thread, the data from the library will be synchronized to the main library at the millisecond level. My SSDB installation package path is:/export/servers/ssdb-master
My SSDB working directory is:/USR/LOCAL/SSDB
Download and install:
$ wget--no-check-certificate Https://github.com/ideawu/ssdb/archive/master.zip
$ unzip Master
$ CD Ssdb-master
$ make
$ # will be installed in the/USR/LOCAL/SSDB directory or specify directory make install Prefix=/home/servers/ssdb
$ sudo make install
#以默认环境配置为例:
$ cd/usr/local/ssdb
# Start the main library, or you can customize the configuration file to start multiple instances
$./ssdb-server ssdb.conf
# Start, stop, restart
# $./ssdb-ins.sh Start/stop/restart ssdb.conf
# start as a background process
$./ssdb-server-d ssdb.conf
# start the Ssdb command line, under the installation package path, 8889 ports for the main library
$/export/servers/ssdb-master/tools/ssdb-cli-p 8889
# command line to connect the remote SSDB service
# $/export/servers/ssdb-master/tools/ssdb-cli-h 192.168.1.1-p 8889
# Stop Ssdb-server, the default is to manually stop the SSDB service
$ Kill ' cat./var/ssdb.pid '
# or first find the PID of the current SSDB process and then the lore
# $ Ps-ef|grep ' Ssdb '
# $ kill-9 6912
SSDB Installation

SSDB Installation Example Diagram

Installation package Description: SSDB work default directory:/usr/local/ssdb
Configuration file:/usr/local/ssdb/ssdb.conf
Data and instance configuration:/usr/local/ssdb/var/
Boot Start command:/etc/init.d/ssdb.sh
Start-up permissions: chmod ugo+x/etc/init.d/ssdb.sh
Default port: 8888

SSDB startup scripts (with OS self-booting):

So far, you need to manually manage the ssdb-server process and if you want to manage it automatically when the operating system starts and stops, follow the instructions below.

Assuming you have installed SSDB in the default/usr/local/ssdb directory, place the tools/ssdb.sh script under the installation package in the/ETC/INIT.D directory. Modify the/data/ssdb_data/test/ssdb.conf in/etc/init.d/ssdb.sh to the path of your SSDB profile, and if you have multiple ssdb instances, write them on one line, separated by spaces:
# each config file for one instance
Configs=/data/ssdb_data/test/ssdb.conf/data/ssdb_data/demo/ssdb.conf
Main master, Master and slave configuration:
Service port configuration for the current instance
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
Subordinate
The following is an example of the main library ip:192.168.1.1
#server 1 (Master)
Replication
Slaveof:
#server 2 (from)
Replication
Slaveof:
Id:svc_1
# Sync|mirror, default is Sync
Type:sync
ip:192.168.1.1
port:8888
Master-Master (dual-master)
The following is an example of the main library ip:192.168.1.1/192.168.1.2
#server 1
Replication
Slaveof:
id:svc_2
# Sync|mirror, default is Sync
Type:mirror
ip:192.168.1.1
port:8889
#server 2
Replication
Slaveof:
Id:svc_1
# Sync|mirror, default is Sync
Type:mirror
ip:192.168.1.2
port:8888
Attention:
1, if there is an outage, power down, kernel panic and other system failures, you need to manually delete the SSDB PID file, if the tools/ssdb.sh/etc/init.d/restart after the automatic removal of PID;
2, the default configuration of the log files by volume separation, you need to write their own crontab for log compression and periodic cleanup;
3, the configuration of the IP is best 0.0.0.0, external access, if the 127.0.0.1 can only be native access.

Using the SSDB command-line client (SSDB-CLI)

SSDB's command line client SSDB-CLI can be used for daily housekeeping, including viewing the SSDB's run-line status (info), as well as doing things that the API does not, such as emptying the entire database. 1, running line SSDB-CLI
# Connect to 127.0.0.1:8888,
$/usr/local/ssdb/ssdb-cli-h 127.0.0.1-p 8888
You can enter the letter "H" and press ENTER to view the Help information.
2, the line KV operation
Ssdb 127.0.0.1:8888>get Key
Ssdb 127.0.0.1:8888>set Key 1
Ssdb 127.0.0.1:8888>del Key
3, the line HashMap operation
Ssdb 127.0.0.1:8888> hsize H
Ssdb 127.0.0.1:8888> hset H K1 vb
Ssdb 127.0.0.1:8888> hset H K2 VA
Ssdb 127.0.0.1:8888> hset H K3 VC
Ssdb 127.0.0.1:8888> hscan H "" "" 10
Ssdb 127.0.0.1:8888> hclear H
4, the line Zset operation
Ssdb 127.0.0.1:8888> zsize Z
Ssdb 127.0.0.1:8888> zset z K1 2
Ssdb 127.0.0.1:8888> Zset z K2 0
Ssdb 127.0.0.1:8888> zset z K3 1
Ssdb 127.0.0.1:8888> zscan z "" "" "" 10
Ssdb 127.0.0.1:8888> zclear Z
RELATED links:
SSDB Project homepage and source code download: Https://github.com/ideawu/ssdb
SSDB Author's website: http://www.ideawu.net/blog/
SSDB API Documentation: http://www.ideawu.com/ssdb/docs/zh_cn/php/
redis:http://redis.io/
LevelDB Project Home: https://code.google.com/p/leveldb/

This address: http://www.linuxidc.com/Linux/2016-12/137825.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.