rs0:FATAL error after recreating the deleted Previous Primary Member in 3 Machine cluster created using VMWare - mongodb

In my project MongoDb is installed in our software.I created 3 Machines in cloud Using VMWare. Regarding my testbed I can say that, I have ESXI software installed in cisco UCS-Blade and above that,we are creating our VM Machines with our created software(MongoDB 2.4.6 is already pre-installed in our software).
For checking cluster creation,I created 3 VM Machines and created cluster among themselves.I created a database and put some data in primary and its successfully reflecting in other Machines.
Then to check replication,I switched off the primary VM and other machine from secondary become primary as excepted.
But when I created the machine by using the same ip(The IP of the Machine which I deleted Previously),in mongodb its giving rs0):FATAL error.It is not going to secondary VM as excepted.
If I type rs.status() in that machine its always telling its in syncing state.
Request you to kindly help on this regard or if its a known bug,pls give me the bug ID.

Got my Answer from Outside Source.So thought of knowledge sharing for others to follow.
A MongoDB node can come up in FATAL state (not joining back its cluster) if a database content is too much out-of-sync.
You can find the current node status by running the mongo shell with command ‘mongo’ – the status is in the shell prompt. You can exit the shell using “exit”.
To recover from this situation manually, do the following:
1) On the ‘FATAL’ node, run mongo shell with the command ‘mongo’;
2) In the mongo shell, list all local databases using “show dbs”;
3) For each database present, do “use ” and “db.dropDatabase()”;
4) After all databases are gone, do “use admin” and “db.shutdownServer()”;
5) Upstart will restart mongo server automatically and it will now join the cluster and sync.

Related

enabling multiple instances of mongodb on Ubuntu 20.04

I am working on a SaaS application where there will be a separate database for each tenant and one landlord/master database for the landlord. So
foo.example.com will connect the sales_foo database
bar.example.com will connect the sales_bar database and so on.
Now I have two environments, staging and testing both on the same server managed by a virtual host. So the problem is if I have 10 tenants then there will be 10 databases plus one landlord database. These all databases should be in one environment and one environment should not access other environment's databases. How can I achieve this?
Till now I have created separate .conf file for each environment and I can start mongod process with that conf as well. But how can I keep it enable all the time? Is it possible?
On a side note, I am using laravel for interacting with database.

Migrate mongodb to Google Cloud Compute Cluster

I have a mongodb in a replica set running with a cloud provider called compose.io.
I just created a new Google cloud compute mongodb cluster using these instructions
I want to copy all the data in my compose database to the compute instance.
One path I have been following has led me to get a file system backup of the running database and store it locally. I have opened that database locally and executed mongodump (I didn't seem to have permission to do that against the remote database) so I have the output of mongodump and a file system copy of the database stored on my machine.
I have no idea how to get any of this in to the compute cluster I created. I don't seem to be able to run mongorestore although figuring that out is still my main path at the moment. I am getting authentication errors which may be my not getting the command right or a database configuration issue. I am not sure yet.
I tried mongorestore from my local machine to the machine holding the primary database in the replica set.
Edit:
The last thing I tried was copy scp the mongodump output on to that machine and run mongorestore there.
I got this error:
2015-01-28T23:35:40.303+0000 Creating index: { key: { _id: 1 }, ns: "admin.system.users", name: "_id_" }
Error creating index admin.system.users: 13 err: "not authorized to create index on admin.system.users"
Aborted
Now I don't seem to be able to run any commands in mongo that require any kind of privileges, such as list database. Tried passing credentials for users that existed in the original database but that is not working so far.
Here is one possible fix.
Turn off auth in mongod.conf:
# mongod.conf
#auth=false
noauth=true
Run the mongorestore, then restart mongod with auth enabled.

Mongo Java Replica Set - Can't find master

I'm having problem with connecting to Mongo Replica Set in production. Replica Set has master on one machine, and secundary + arbiter on other machine.
When I run my application locally it connects and uses Replica Set properly. I'm using Windows OS.
Mongo URI is like this:
mongodb://192.168.2.95:20000,192.168.2.96:20000/testDatabase
I'm using Java Driver 2.10.1.
When I deploy application in production server, It can't use replica set. Error is "can't find master".
When I change mongo URI to use single node, like this:
mongodb://192.168.2.95:20000/testDatabase
then it works!
What's the problem? I have search the web and I found few people with similar problem but I didn't found any proper solution...

ideal vm setup for meteor with shared folder

situation
Hello, I run arch Linux for which there is no meteor package and have an Ubuntu server run within virtualbox for web development. There is a shared folder I mount through database. hich means I can code in to the active environment.
However, like many others, I have a problem with mongodb starting up, specifically the exit code 100.
tracing the problem:
I created the /data/DB directory
gave access rights to my user
ran mongod on its own with no problems
Still I have the issue though.
Question
Where is the configuration file for mongodb which is installed with meteor so I can move it and do I need to create rights for a 'mongodb' user?
Question
What would be the ideal virtual machine for running a meteor development environment in the above set up? Having to create the data directory in the first place tells me Ubuntu server isn't ideal. some extra documentation available to answer this second question appearing on the meteor website would be beautiful
MongoDB does not work correctly on virtualbox shared folders. By default, meteor creates a mongo database in your project's directory, however you can override this behavior with the MONGO_URL environment variable. If you set this variable, meteor will not try to start mongo and will instead connect directly to the mongo endpoint you specify. This allows you to setup mongo however you like (eg using the Ubuntu mongodb package), with data somewhere not in the shared folder.

Postgresql cluster initialization

SQL distributes pre-initialized catalog cluster but for postgresql we need initialize cluster using initdb and a network service account. It fails in few cases and causing bit of misery!
Can initialize cluster ourselves and distribute pre-initialized cluster?
Thanks
The "cluster" (or data directory) depends on the operating system and the architecture. So a data directory that was initialized with initdb on a 32bit Linux will not work on a 64bit Windows.
But you don't need to do that. A service account is only necessary if you want to run PostgreSQL as a service.
You can easily use the ZIP distribution to install and start Postgres without the need for a full-fledge installation or a service account.
The steps to do so are:
Unzip the binaries
Run initdb pointing it to the directory where the database cluster should be created.
Run pg_ctl to start the server.
Note that the steps 2) and 3) must be run using the same user, otherwise the server will have no priviliges to write to the data directory.
These steps can easily be put into a batch file or shell script.
Hard to understand your question, but I think you are talking about the Windows installer for PostgreSQL. Right? What version, what installer, what about error messages, loggings, etc. ?
The installer can be found here.
SQL = database language, SQL Server =
Microsoft database product