Someone asked me, Redis multiple databases, is not the start of multiple Redis processes, listening to different ports. At some level, this can be considered, but not recommended.
1,redis Database
The number of Redis databases is set dead in the configuration file, and the name is not allowed to be changed.
Databases 16//default 16 databases
These 16 database numbers are 0-15, and if the database is not switched, the default is the No. 0 database.
# telnet 127.0.0.1 6379
Trying 127.0.0.1 ...
Connected to 127.0.0.1.
Escape character is ' ^] '.
Set test 123//In database No. 0 setting test to 123
+ok
Select 1//Switch to number 1th database
+ok
Set test 456//Set test to 456
+ok
Get test//1th database test is 456
$
456
Select 0//switch to number NO. 0 database
+ok
Get Test//test is 123
$
123
The same key between databases is not affected by each other.
2,mongodb Database
MongoDB is very much like a relational database, unlike Redis, MongoDB the database name is customized without the number of databases defined beforehand. less restrictive than Redis.
# mongo
MongoDB shell version:2.6.4-pre-
connecting to:test
> Use tank/ /tank database exists, switch to tank, and if not, create tank database
switched to DB tank