@phenomlab OK thanks. I will install it later then.
Restoring/Upgrading nodeBB - Procedure
I'm testing restoring nodeBB after a reboot on my server or a crash for example.
I set up redis with the default config:
I start nodeBB
This doesn't work, I have to run ./nodebb setup before ./nodebb start or the forum just show the top bar
After a setup, I can start the forums fine but it is a fresh new forums, seems like it did not load dump.rdb from redis. I lost all my categories and settings in nodeBB. Where is the category and settings saved on nodeBB? does running a "setup" overwrite them?
I would really like to be able to save Redis database and be able to restore it before thinking of going in production with nodeBB.
Is there a guide available because I followed the "update" procedure but seems like I'm missing something
Seems to have found the correct procedure, problem was I started Redis-server in a different location so the dump.rdb was not in /var/lib/redis like it should have been
1- Save redis-server latest db
2- shutdown nodeBB and redis-server
3- backup the corresponding dump.rdb file (location will be where you started redis-server)
1- Delete old dump.rdb if present
2- upload good dump.rdb
3- start redis-server at the location where dump.rdb is
4- start nodebb
1- Save redis-server latest db
redis-cli bgsaveis a better one for you, I believe.
restoring nodeBB after a reboot on my server or a crash for example
Why wouldn't you add NodeBB as a daemon? It's a good practice for production. Simply let your kitten to make a proper file in
/etc/init.d/(if debian-like linux)
does running a "setup" overwrite them?
No, it doesn't overwrite anything except
config.json. It just makes categories if they are not exists yet.
Thanks Mega, I'm a newbie on Linux (just starting using CentOS on a VPS).
As of right now after a system reboot I have to manually start redis-server then nodeBB.
Will look for ways to automate that
Also probably not good to start redis-server with the default config?
What would be the best way to start redis so that the dump.rdb is always loaded/saved from the same spot? Thanks!
@maximus123 When you run redis, it reads a configuration file to know what to do. In Ubuntu, this default file is located at
In this file is defined where the
dump.rdbfile is saved. Probably the
If you run Redis the same way each time, the location of
dump.rdbshould not change.
Also nice to know: Make sure redis is shut down before removing/replacing
dump.rdb, otherwise when you restart/stop redis, it will just overwrite your new
dump.rdbwith the database in memory!
Thanks for the tips! However, it seems starting redis-server without a .conf file just create the dump.rdb in the same folder you start Redis (using Redis 2.8.19)
I had to redownload the redis.conf for 2.8.19, and can now start redis-server with the conf file in argument, I added the db path under "SNAPSHOTTING" in the redis.conf
This is a good guide but I ran into a problem (surprise surprise) which may stem from original setup running Redis-server command run from a different dir, but I am not sure or how to find that out, but the Redis config file does point ot the
/var/lib/redisdir so maybe my assumption is wrong.
This is what happens once I have successfully switched out the dump.rdb file into the
Clustering enabled: Spinning up 1 process(es). 2020-01-17T21:22:19.558Z [4567/1372] - info: Initializing NodeBB v1.12.2 https://www...... [benchpressjs] Unable to build or find a suitable native module, falling back to JS version 2020-01-17T21:22:22.799Z [4567/1372] - error: Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec: 2020-01-17T21:22:22.799Z [4567/1372] - error: ./nodebb upgrade [cluster] Child Process (1372) has exited (code: 0, signal: null)
I ran the upgrade to see what might happen and I hit the same problem of a nodebb with empty menu bar at the top and more or less blank everything else.
I used the
SHUTDOWN NOSAVEin Redis-cli
I guess there is the possibility the dump.rdb is corrupted or missing some data.
This is continually peculiar and I really like getting myself into a bind...
I have started
redis-server /with/path/to/redis.confafter deleting the old dump and replacing with the new one.
Then I restart nodeBB but it loads up with the old data! HUH?
Where is nodeBB picking up the old DB from memory or is there a snapshot conflict or something I have no awareness of, this is a simple enough process
I did a thing to test my curiosity - I shutdown redis twice in a row via redis-cli, after the first shutdown command it dumped the older dump file and then I deleted it.
Then I ran the same shutdown command a second time with save and lo and behold it dumped an identical db in
/var/lib/redis- so is it really shutdown or is it pulling the older db that I am trying to flush out from somewhere else?
My initial thought was redis is not really shutting down.
@omega That's right, if shutting down redis over and over again is saving old data into the dump file, then Redis itself is not shutting down properly.
Redis itself never persists anything into memory (or rather, it shouldn't) once it shuts down, it's all dumped to disk.
Are you sure it's stopped? Check
ps aux | grep redisfor any errant processes. What does the redis log file in
/var/logsay? Any errors when shutting down?