Question

Here is the scenario I have.

I created 1 bucket in couchbase called, "mybucket" and have mach1 and mach2 configured to failover each other for that bucket.

Machine1:

**mach1.myserver.com**
couchbase and lighttpd.
webapps installed on this machine pointing to couchbase bucket called "mybucket" at mach1.myserver.com

Machine2:

**mach2.myserver.com**
couchbase and lighttpd
webapps installed on this machine pointing to the couchbase bucket called "mybucket" at mach2.myserver.com

enter image description here

when I go to URL mach1.myserver.com, the webapps connection succesful.

However when I go to URL mach2.myserver.com. the webapps connection failed. They both are connected to the same bucket called "mybucket"

Am I missing something in this configuration. First of all, does it make any sense at all what I'm facing here? Please advise?

Was it helpful?

Solution

I think that you have been misled by this question Architecting webserver (NginX/Lighttpd/Apache) with couchbase and it's answer. Because you've asked about couchbase and answer was only about loadbalancer.

So first of all if you want to build scalable application never use same server for database and application. That could be even virtual machines on one hardware, but don't place webserver and database on one physical/virtual server. Especially if you're planning to use couchbase. Couchbase likes to eat too much iops, so your web server could have insufficient iops.

In situation you've described my choise would be to have separate servers for webapp and couchbase. Server pairs webapp-couchbase should be placed near each other (i.e. at least in one datacenter) to minimize latency. You should configure couchbase servers as standalone clusters with XDCR replication (also check what ports are needed to be open for couchbase). Then configure webapp to connect to the nearest server. But in this case you should care about "high availability" by yourself: check this question to see some advices. If you connect all couchbase servers in one cluster, it will destribute documents around all servers in cluster and even if you connect from web app only to the nearest server, data will be collected from all couchbase servers in cluster.

If you'll have some more questions or I should explain something better - just ask in comments and I'll update my answer.

UPD: If you're using couchbase >= 2.1.1 you can configure it with hostnames.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top