Redis Bulk import of key value data to Redis Library

Source: Internet
Author: User

Brief Description:

The Data.txt file in the script is generated on the Linux server side of the PHP program, and the contents are as follows:

[[email protected] ~]# tail -5 /data/www/e456tadd/data.txtSET 447a70c342e677ac 1,1SET 6ec81c6c460038ae 9,1SET 121a61e082c3cd67 1,1SET 91d08ae6d6ff27e0 11,1

Import the Data.txt file data directly to the Redis error prompt et not Found, and therefore suspect that the file format is not correct, so install Dos2unix command format conversion data.txt file. After the format conversion continue to import data.txt data to Redis, but still prompt error prompts et not Found
Then install Unix2dos, continue to format conversion Data.txt file, re-import Redis, successfully imported

Add script to timed task, result script execution failed
The script then joins the Source/etc/profile.
Alas, mom, finally succeeded.

Import Logging:
[Email protected] ~]# Cat/data/www/getqd/redis-load.log

2018-10-11 12:15:01All data transferred. Waiting for the last reply...Last reply received from server.errors: 0, replies: 10142018-10-12 02:30:01All data transferred. Waiting for the last reply...Last reply received from server.errors: 0, replies: 1167

The script reads as follows:

[[email protected] ~]# cat /data/scripts/redis-load.sh #!/bin/bashsource /etc/profile/usr/bin/unix2dos /data/www/e456tadd/data.txt  >>/data/www/e456tadd/redis-load.logecho $(date "+%Y-%m-%d %H:%M:%S") >>/data/www/e456tadd/redis-load.logcat /data/www/getqd/data.txt |redis-cli -h 127.0.0.1 -p 20004 -a ‘YH345667tuEq‘ --pipe >>/data/www/e456tadd/redis-load.log

Redis Bulk import of key value data to Redis Library

Related Article

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.