Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build SSDB Master-Slave Environment under Redis and Ubuntu14

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to build SSDB master-slave environment under Redis and Ubuntu14". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build SSDB master-slave environment under Redis and Ubuntu14".

In the work came into contact with Redis,Redis is a very efficient key-value database, widely used in the project, but the obvious disadvantage of redis is the processing of memory, at the beginning of the project, memory planning must be reasonable, otherwise it is easy to appear memory burst phenomenon, generally more reasonable memory size for the computer physical memory 3x5.

Redis provides a variety of data types, I often use for String, Hash, List, Set, Sorted Set, basically meet the requirements of the project for data types. We are using Redis's Java client, which provides a series of api corresponding to the Redis command. Redis persistence provides a variety of strategies, but we did not do persistence. After our own research, AOF feels to be the most reliable. The principle is very similar to Mysql's binary log. It also records the operation information to a file, reads the log from the server and performs the operation.

In ordinary private network development, you may often need to adjust the details of data storage, so if the previous data still resides in memory, it will cause many functions to fail to function properly, so you need to Flushdb the Redis database after adjusting the details.

Redis and Ssdb are suitable for use in some scenarios, for example, some data can only be left in the database for 2 minutes, similar to the YY channel T person. If you can enter the database after a few minutes, you can use the setex key seconds value command, and then you can use the exists key command to determine whether it expires.

Redis Common Command website: http://redis.readthedocs.org/en/latest/ covers redis commands and demo.

Say Redis before taking Ssdb, because Ssdb is well compatible with Redis's API. It's a good substitute for Redis.

Ssdb has many advantages over Redis: it is 100 times the capacity of Redis database and can store billions of data. Compared to Redis, it takes up very little memory. So I also went to download ssdb, the following is the process of building ssdb.

Environment: ubuntu14 virtual machine A: 192.168.1.251 virtual machine B: 192.168.1.252 gateway: 192.168.1.1

My two virtual machines are installed on different physical machines, but both use bridging mode, and the ip address is in the same ip segment.

Install ssdb online under both virtual machines.

Wget--no-check-certificate https://github.com/ideawu/ssdb/archive/master.zipunzipmastercdssdb-mastermakesudomakeinstall

All of these can be found on the ssdb website, http://www.ideawu.com/ssdb/zh_cn/.

Ssdb master / slave construction is actually very simple, you only need to find ssdb.conf in the ssdb installation directory of the two virtual machines.

Sudovissdb.conf

Modify the ip under server to the default IP address of the virtual machine.

Virtual machine A:

Server:ip:192.168.1.251port:8888// my port has not been changed, use the default

Virtual machine B:

Server:ip:192.168.1.252port:8888

This is the most basic configuration.

Now just configure it under ssdb.conf on the basis of A:

Replication:slaveof:#toidentifyamasterevenifitmoved (ip,portchanged) # ifsettoemptyornotdefined,ip:portwillbeused.id:svc_2#sync | mirror,defaultissynctype:syncip:192.168.1.252port:8888

Note: in the above configuration process, do not use the spacebar, use tab.

Now you can start ssdb.

. / ssdb-serverssdb.conf

You can then use the command-line tools provided by ssdb to operate.

Virtual machine A:./ssdb-cli-h 192.168.1.251-p 8888

Virtual machine B:./ssdb-cli-h 192.168.1.252-p 8888

Thank you for your reading, the above is the content of "how to build SSDB master-slave environment under Redis and Ubuntu14". After the study of this article, I believe you have a deeper understanding of how to build SSDB master-slave environment under Redis and Ubuntu14. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report