I accidentally deleted the redis file under ./etc now i cannot seem to connect to the redes serve. is there anyway I could reinstall redis in it? if so how? please help me. Thank you in advance
Asked
Active
Viewed 382 times
1 Answers
0
Hm... It seems to be '/etc'.
You can manually build and install. It is described in https://redis.io/download#installation.
Or reinstall package via package manager like yum - if the redis was installed by package manager.
$ yum --enablerepo=epel,remi reinstall redis
But in your case I think it's okay if you make a /etc/redis/* file like redis.conf. Here is a script run example is installing redis version is 3.2.8 with default setting.
$ wget http://download.redis.io/releases/redis-3.2.8.tar.gz
$ tar xzf redis-3.2.8.tar.gz
$ cd redis-3.2.8/utils
$ sudo ./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [] /usr/local/bin/redis-server
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
$
After then, you should configure other parameters like password, bind, ...
I hope it is helpful.

Yoonian
- 547
- 9
- 13
-
hi thank you. I tried yum --enablerepo=epel,remi reinstall redis. but doesnt make any difference at all. also tried, $ wget http://download.redis.io/releases/redis-3.2.8.tar.gz $ tar xzf redis-3.2.8.tar.gz but when I go to cd redis-3.2.8/util is says : -bash: cd: redis-3.2.8/util: No such file or directory – fyeah Feb 22 '17 at 05:12
-
oops not redis-3.2.8/util but redis-3.2.8/utils. – Yoonian Feb 22 '17 at 05:14
-
how about copying this file http://download.redis.io/redis-stable/redis.conf into /etc/redis/redis.conf – Yoonian Feb 22 '17 at 05:18
-
still doesn't work. is it possible to remove all redis package and intallation and reinstall redis all over from scratch? – fyeah Feb 22 '17 at 05:28
-
may I know your OS kinds? please let me know result of uname -a – Yoonian Feb 22 '17 at 05:29
-
thanks its : 83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux – fyeah Feb 22 '17 at 05:31
-
for removing: sudo apt-get remove redis-server for installing: sudo apt-get install redis-server – Yoonian Feb 22 '17 at 05:35
-
[install and configure redis on ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04) may be helpful to you – Yoonian Feb 22 '17 at 05:42
-
thank you so much. I'm new to this, is redis-stable and redis-server different? – fyeah Feb 22 '17 at 05:57
-
redis-stable means redis stable version. redis-server is for package name for apt-get. – Yoonian Feb 22 '17 at 05:58
-
should I have to install both? – fyeah Feb 22 '17 at 06:00
-
no. just one. in your case you installed redis by package manager(apt-get). – Yoonian Feb 22 '17 at 06:02
-
ohh, what would you recommend? redis by package manager? or the redis-stable? which is which? (for production purpose btw) – fyeah Feb 22 '17 at 06:05
-
also, when I tried to do redis-cli ping, it give me this message : MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. what am I doing wrong? – fyeah Feb 22 '17 at 06:10
-
I think package manager version is good for you and production also. Normally package version is easy to manage and little bit older than stable version. But if you are good at managing redis, the choice is redis-stable(build by yourself). – Yoonian Feb 22 '17 at 06:14
-
oh thank you so much for this information. but I wonder why couldn't seem to test redis-cli ping? with this err MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. – fyeah Feb 22 '17 at 06:17
-
for MISCONF Redis is configured to save RDB snapshots, you can set config set stop-writes-on-bgsave-error no via redis-cli if you don't want to save(or persist). you can refer http://stackoverflow.com/questions/19581059/misconf-redis-is-configured-to-save-rdb-snapshots. – Yoonian Feb 22 '17 at 06:17
-
great! it worked! thank you so much. hey I'm going to create a new issue with redis session can you help me? thanks a lot ^^ – fyeah Feb 22 '17 at 06:28
-
lol here: http://stackoverflow.com/questions/42342251/passing-the-session-data-from-passport-to-redis-in-production thanksssssssssss ^^ – fyeah Feb 22 '17 at 06:39
-
hi are you still there? lol another thing, when I ran sudo service redis status it gave me this msg : Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor pre Active: deactivating (final-sigterm) (Result: timeout) since Mon 2017-02-20 0 Docs: http://redis.io/documentation, man:redis-server(1) isn't that suppose to be activated? instead of deactivating? – fyeah Feb 22 '17 at 07:07
-
here: sudo tail /var/log/redis/redis-server.log -n 100 sudo: unable to resolve host api 18273:M 20 Feb 07:36:23.097 * 1 changes in 900 seconds. Saving... 18273:M 20 Feb 07:36:23.098 * Background saving started by pid 26916 26916:C 20 Feb 07:36:23.100 * DB saved on disk 26916:C 20 Feb 07:36:23.100 * RDB: 0 MB of memory used by copy-on-write 18273:M 20 Feb 07:36:23.198 * Background saving terminated with success – fyeah Feb 22 '17 at 08:24
-
18273:signal-handler (1487594204) Received SIGTERM scheduling shutdown... 18273:signal-handler (1487594204) Received SIGTERM scheduling shutdown... 18273:M 20 Feb 07:36:45.064 # User requested shutdown... 18273:M 20 Feb 07:36:45.065 * Saving the final RDB snapshot before exiting. 18273:M 20 Feb 07:36:45.066 * DB saved on disk 18273:M 20 Feb 07:36:45.066 * Removing the pid file. 18273:M 20 Feb 07:36:45.067 # Redis is now ready to exit, bye bye... – fyeah Feb 22 '17 at 08:24
-
It is like an user requested shutdown. so how about start again? `sudo systemctl start redis` and check again? `sudo systemctl status redis` [the link](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04) is helpful. – Yoonian Feb 22 '17 at 08:31
-
Feb 22 03:30:16 api redis-server[15493]: 19737:C 22 Feb 03:30:16.075 # Failed op Feb 22 03:30:16 api redis-server[15493]: 15493:M 22 Feb 03:30:16.174 # Backgroun – fyeah Feb 22 '17 at 08:31
-
Feb 22 03:30:22 api redis-server[15493]: 15493:M 22 Feb 03:30:22.091 * 1 changes Feb 22 03:30:22 api redis-server[15493]: 15493:M 22 Feb 03:30:22.092 * Backgroun Feb 22 03:30:22 api redis-server[15493]: 19740:C 22 Feb 03:30:22.094 # Failed op Feb 22 03:30:22 api redis-server[15493]: 15493:M 22 Feb 03:30:22.193 # Backgroun Feb 22 03:30:28 api redis-server[15493]: 15493:M 22 Feb 03:30:28.013 * 1 changes – fyeah Feb 22 '17 at 08:31
-
Feb 22 03:30:28 api redis-server[15493]: 15493:M 22 Feb 03:30:28.017 * Backgroun Feb 22 03:30:28 api redis-server[15493]: 19743:C 22 Feb 03:30:28.018 # Failed op Feb 22 03:30:28 api redis-server[15493]: 15493:M 22 Feb 03:30:28.117 # Backgroun lines 1-19 – fyeah Feb 22 '17 at 08:31
-
I followed the linkyou provide still getting the same error : – fyeah Feb 22 '17 at 08:33
-
I tried to sudo systemctl start redis it only hang up and did nothing – fyeah Feb 22 '17 at 09:04
-
By checking your log file, `19743:C 22 Feb 03:30:28.018 # Failed op`. yes it was cutted :P, redis failed to open *.rdb file. – Yoonian Feb 22 '17 at 09:09
-
please check http://stackoverflow.com/questions/19581059/misconf-redis-is-configured-to-save-rdb-snapshots – Yoonian Feb 22 '17 at 09:10
-
There? How about modifing `loglevel debug` in `/etc/redis/redis.conf` and look into `/var/log/redis/redis-server.log`. Then you can find the reason. – Yoonian Feb 23 '17 at 07:28