In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In the actual production scenario, redis data may need to be migrated in the production environment due to the relocation of the server room or the replacement of the physical machine. So what should be done to migrate redis databases in redis-dump and redis-load? You know what? In order to let you know more about the method of migrating redis database, the editor summarizes the following contents. Let's look down together.
Generally speaking, there are three ways to migrate redis data:
1. Third-party tool redis-dump,redis-load
2. Aof mechanism. You need to enable aof function.
3. Rdb storage mechanism
Here is the first way to export data through redis-dump and then import it through redis-load. Let's go.
Step 1: install gcc
The terminal executes the gcc command, and if prompted without this command, it needs to be installed. Otherwise skip this step
Yum-y install gcc automake autoconf libtool make
Step 2: configure the Ruby official network source address
Because the default Ruby official network source address is abroad, and the access speed is very slow, it needs to be configured as a domestic source address.
Gem sources-a http://gems.ruby-china.org/ add domestic source address gem source-l check whether gem source has been added successfully-- remove http://rubygems.org/ remove foreign source address gem source-l confirm that the current source address is only domestic
Step 3: install the rvm command
Configure Google DNS / etc/resolv.conf nameserver 8.8.8.8gpg2-- keyserver hkp://keys.gnupg.net-- recv-keys D39DC0E3 curl-L get.rvm.io | bash-s stableecho "export rvm_max_time_flag=20" > > ~ / .rvmrc
Step 4: install Ruby
Rvm install 2.3.3
Step 5: confirm the Ruby version
Because redis-dump must require that the version of ruby be no less than 2.2.2
Ruby-v
If the output is ruby 2.3.3xxx, you are using the correct version and skip to the next step. Otherwise, you also need to do the following:
Rvm use 2.3.3-default
Set the version that uses ruby by default to 2.3.3.
Rvm remove $version
Delete the old version, $version is the version found by ruby-v, just specify the previous numeric version number.
Step 6: install redis-dump
Gem install redis-dump-V
Step 7: confirm that redis-dump is installed successfully
Find /-iname redis-dump
Step 8: redis-dump export data
All data exported with redis-dump are in json format.
Redis-dump-u: yourpassword@127.0.0.1:6379 > / tmp/redis-mv.json pay attention to change it to your own password, and remove it if you don't have one.
Step 9: move the exported data file to the imported redis server
Step 10: redis-load Import data
Cat redis-mv.json | redis-load-u: yourpassword@127.0.0.1:6379 pay attention to change it to your own password. If you don't have one, remove it.
At this point, the data is migrated. Don't forget to check and verify the imported redis.
The above is a brief introduction of how to migrate redis database by redis-dump and redis-load. Of course, the differences in the detailed use of the above have to be understood by everyone. If you want to know more, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.