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