Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to bind hiredis-vip client to a particular IP and port? #118

Open
raghuiisc opened this issue Jul 9, 2019 · 1 comment
Open

How to bind hiredis-vip client to a particular IP and port? #118

raghuiisc opened this issue Jul 9, 2019 · 1 comment

Comments

@raghuiisc
Copy link

No description provided.

@LazyHippogriff
Copy link

redisClusterContext* DbConnect(string ip, string port)
{
        redisClusterContext* m_DbContext = redisClusterContextInit();
        struct timeval timeout = {1,500000};
        string ipPort=ip+string(":")+port;
        redisClusterSetOptionAddNodes(m_DbContext, ipPort.c_str());
        redisClusterSetOptionConnectTimeout(m_DbContext, timeout);
        redisClusterSetOptionRouteUseSlots(m_DbContext);
        redisClusterSetOptionParseSlaves(m_DbContext);
        redisClusterConnect2(m_DbContext);
        if (m_DbContext != NULL && m_DbContext->err) {
                printf("\n[%s::%d]Error: %s\n",__FILE__,__LINE__,m_DbContext->errstr);
                exit(-1);
        }
        return m_DbContext;;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants