当前位置:网站首页>Redis installation and setting up SSDB master-slave environment under Ubuntu 14.04
Redis installation and setting up SSDB master-slave environment under Ubuntu 14.04
2022-07-01 14:49:00 【Brother Xing plays with the clouds】
Come into contact with in the work redis,Redis It's a very efficient key-value The database of , Widely used in projects , however redis The obvious disadvantage is the processing of memory , At the beginning of the project launch , The memory must be reasonably planned , Otherwise, it is easy to cause memory explosion , Generally, the reasonable memory size is... Of the physical memory of the computer 3/5.
redis Multiple data types are available , What I often use is string 、hash、list、set、sorted set, It can basically meet the requirements of the project for data types . We use redis Of Java client , Provides a series of solutions for redis The command corresponds to api.redis Persistence of provides a variety of strategies , But we didn't do persistence , I studied it myself ,AOF The way I feel is the most reliable , The principle and mysql The binary log of is very similar , It also records the operation information and writes it to the file , from The server Read the log and perform the operation .
In ordinary Intranet development, you may often need to adjust the details of data storage , So if the previous data still resides in memory , Many functions will not work properly , So after adjusting the details , Need to be right redis database flushdb operation .
redis And ssdb It is suitable for use in some scenes , For example, some data can only remain in the database 2 minute , similar YY channel T people , Fix it for a few minutes before you come in , You can use setex key seconds value command , Then judge whether it is expired and pass exists key command .
redis Common command website :http://redis.readthedocs.org/en/latest/ covers redis Orders and demo.
On the road ssdb Say before redis, because ssdb Very compatible redis Of api. yes redis A good substitute for .
ssdb be relative to redis It has many advantages : yes redis Database 100 Times the capacity , It can store billions of data . relative redis Come on , It takes up very little memory . So I downloaded it myself ssdb, Here are ssdb The process of building .
Ubuntu 14.04 Next Redis install And simple tests http://www.linuxidc.com/Linux/2014-05/101544.htm
Redis colony Detailed documents http://www.linuxidc.com/Linux/2013-09/90118.htm
Ubuntu 12.10 Lower installation Redis( Graphic, )+ Jedis Connect Redis http://www.linuxidc.com/Linux/2013-06/85816.htm
Redis series - Installation, deployment and maintenance http://www.linuxidc.com/Linux/2012-12/75627.htm
CentOS 6.3 install Redis http://www.linuxidc.com/Linux/2012-12/75314.htm
Redis The configuration file redis.conf Detailed explanation http://www.linuxidc.com/Linux/2013-11/92524.htm
Environmental Science :Ubuntu 14.04
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 they all use bridging ,ip The addresses are all in the same ip paragraph .
Both virtual machines are installed online ssdb.
wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
unzip master
cd ssdb-master
make
sudo make install
These in ssdb You can find it on the official website ,http://www.ideawu.com/ssdb/zh_cn/.
ssdb Master slave construction is actually very simple , You only need two virtual machines ssdb Found under installation directory ssdb.conf.
sudo vi ssdb.conf
modify server Under the ip Default for virtual machine IP Address .
virtual machine A:
server:
ip:192.168.1.251
port:8888 // I haven't changed my port , Use default
virtual machine B:
server:
ip:192.168.1.252
port:8888
This is the basic configuration .
Now as long as A For ssdb.conf The configuration :
replication:
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: 192.168.1.252
port: 8888
Be careful : In the above configuration process , Never use the space bar , Use tab.
Now you can start ssdb 了 .
./ssdb-server ssdb.conf
It can be used later ssdb The command-line tools provided 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
边栏推荐
猜你喜欢
[dynamic programming] p1004 grid access (four-dimensional DP template question)
Buuctf reinforcement question ezsql
Vnctf2022 open web gocalc0
户外LED显示屏应该考虑哪些问题?
sqlilabs less9
[R language data science]: common evaluation indicators of machine learning
241. 为运算表达式设计优先级
微服务开发步骤(nacos)
Internet hospital system source code hospital applet source code smart hospital source code online consultation system source code
一波三折,终于找到src漏洞挖掘的方法了【建议收藏】
随机推荐
期末琐碎知识点再整理
Use the npoi package of net core 6 C to read excel Pictures in xlsx cells and stored to the specified server
Is the futures company found on Baidu safe? How do futures companies determine the regularity
Buuctf reinforcement question ezsql
Research Report on the development trend and competitive strategy of the global chemical glassware industry
Today, with the popularity of micro services, how does service mesh exist?
Fundamentals of C language
首届技术播客月开播在即
Research Report on the development trend and competitive strategy of the global high temperature label industry
Research Report on the development trend and competitive strategy of the global display filter industry
JVM performance tuning and practical basic theory part II
[zero basic IOT pwn] reproduce Netgear wnap320 rce
[dynamic programming] interval dp:p1005 matrix retrieval
Day-02 database
Yyds dry goods inventory hcie security day13: firewall dual machine hot standby experiment (I) firewall direct deployment, uplink and downlink connection switches
NPDP产品经理国际认证报名有什么要求?
户外LED显示屏应该考虑哪些问题?
问题随记 —— Oracle 11g 卸载
Research Report on the development trend and competitive strategy of the global electromagnetic flowmeter industry
【15. 区间合并】