Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6026267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:25:15+00:00 2026-05-23T04:25:15+00:00

I have two same app running on different one for demo and one for

  • 0

I have two same app running on different one for demo and one for developement .and m using the redis database to store key value, how can i seperate redis database for these two different app. m using node.js for redis client. and m using this https://github.com/mranney/node_redis/ redis client.

how to seperate redis database for same app in node.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:25:15+00:00Added an answer on May 23, 2026 at 4:25 am

    You can use the .select(db, callback) function in node_redis.

    var redis = require('redis'),
    db = redis.createClient();
    
    db.select(1, function(err,res){
      // you'll want to check that the select was successful here
      // if(err) return err;
      db.set('key', 'string'); // this will be posted to database 1 rather than db 0
    });
    

    If you are using expressjs, you can set a development and production environment variable to automatically set which database you are using.

    var express = require('express'), 
    app = express.createServer();
    
    app.configure('development', function(){
      // development options go here
      app.set('redisdb', 5);
    });
    
    app.configure('production', function(){
      // production options here
      app.set('redisdb', 0);
    });
    

    Then you can make one call to db.select() and have the options set for production or development.

    db.select(app.get('redisdb'), function(err,res){ // app.get will return the value you set above
      // do something here
    });
    

    More information on dev/production in expressjs: http://expressjs.com/guide.html#configuration

    The node_redis .select(db, callback) callback function will return OK in the second argument if the database is selected. An example of this can be seen on the Usage section of the node_redis readme.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables with the same columns, and I need to copy one
I have two arrays containing the same elements, but in different orders, and I
I have two instances running of same Windows Service. They check the health of
I have two web applications both on the same IIS 7 box. One application
I have created one testing app for running deep counter loop. I run the
I have two applications running in the same java virtual machine, and both use
I have an app that I want to be able to build two different
I have two grids with same number of rows ( also same height). Both
Example: I have two shared objects (same should apply to .dlls). The first shared
I have the situation where i have two databases with same structure. The first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.