Ssdb master-slave synchronous replication configuration detailed steps, ssdb detailed steps
The SSDB configuration file is a hierarchical key-value static configuration file, which uses a TAB indent to represent the hierarchical relationship. The lines starting with '#' are comments.
Ssdb follows the redis protocol and provides fast read/write performance.
Sometimes when we use databases, such as mongodb, redis, and some relational row data, in order to make the data more secure, we often use the master-slave replication architecture as a backup, when there is a problem with the data on the host, we can connect to the slave machine.
That is, another machine will synchronize data from the host. If we use the linux Command netstat-apn, we will find that ssdb on the slave machine will establish a connection with the ssdb service on the host, if we import data to the ssdb of the host at this time
The server Load balancer instance also has data updates.
The specific configuration is as follows (I suppose the IP address of the master machine is 10.100.300.1 port: 8888)
This is the slave machine configuration,
# ssdb-server config# MUST indent by TAB!# relative to path of this file, directory must existswork_dir = ./2014_12_1pidfile = ./2014_12_1/ssdb.pidserver:ip: 0.0.0.0port: 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.168replication: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 synctype: syncip: 10.100.300.1port: 8888logger:level: infooutput: log.txtrotate:size: 1000000000leveldb:# in MBcache_size: 1024# in KBblock_size: 64# in MBwrite_buffer_size: 256# in MBcompaction_speed: 100# yes|nocompression: no
This is the master machine configuration
# ssdb-server config# MUST indent by TAB!# relative to path of this file, directory must existswork_dir = ./var_updatepidfile = ./var_update/ssdb.pidserver:ip: 0.0.0.0port: 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.168replication: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: 127.0.0.1#port: 8889logger:level: infooutput: log.txtrotate:size: 1000000000leveldb:# in MBcache_size: 300# in KBblock_size: 64# in MBwrite_buffer_size: 256# in MBcompaction_speed: 100# yes|nocompression: no
Work_dir: the working directory of ssdb-server. After startup, two directories, data and meta, are generated under this directory to save the database files of LevelDB. this directory is relative to ssdb. the relative path of conf. You can also specify the absolute path.
Server: ip and port specify the IP address and port number of the server to listen. if the ip address is 0.0.0.0, it indicates binding all IP addresses. based on security considerations, you can set the ip address to 127.0.0.1, so that only the local machine can access it. to implement more stringent network security restrictions, you must rely on the iptables of the operating system.
Replication: used to specify master-slave synchronous replication. slaveof. ip, slaveof. port indicates that this SSDB server will synchronize data from this target machine (that is, the server corresponding to this configuration file is slave ). you can refer to the preparation of ssdb_slave.conf.
Logger: Configure logging. level is the log level, which can be trace | debug | info | error. output is the name of the log file. SSDB supports log rotation. After the log file reaches a certain size, rename log.txt and create a new log.txt.
Leveldb: configure the LevelDB parameters. You generally want to modify the cache_size parameter to specify the cache size. An appropriate cache can improve read performance, but a large cache will affect write performance.