MongoDB Replication with Ubuntu and CentOS not working - mongodb

I am trying replication with MongoDB. The process is to be carried out on two different servers having different versions of Unix, the Ubuntu and CentOS respectively. I am facing various issues while doing this. Is this issue causing due to different OS. The replication works smooth with two servers having Ubuntu.

There should be no issue with this. Posting mongod logs from both servers for the failing case would be a good first step for us to help you debug your issue.

Related

MongoDB Performance in Docker

I did an experiment by running a python app that is writing 2000 records into mongoDB.
The details of my setup of the experiment as follows:
Test 1: Local PC - Python App running on Local PC with mongoDB on Local PC (baseline)
Test 2: Docker - Python App on Linux Container with mongoDB on Linux Container with persist volume
Test 3: Docker - Python App on Linux Container with mongoDB on Linux Container without persist volume
I’ve generated the result in chart - on average writing data on local PC is about 30 secs. Where else on Docker, it takes about 80plus secs. Hence it seems like writing on Docker is almost 3 times slower than writing on local PC itself.
Should I want to improve the write speed or performance of the mongoDB in docker container, what is the recommended practice? Or should I put the mongoDB as a external volume without docker?
Thank you!
graph
Your system is not consistent in many ways - dynamic storage and CPU performance, other processes, dynamic system settings etc. There are a LOT of underlying things under storage only.
60 sec tests are not enough for anything
Simple operations are not good enough for baseline comparisons
There is ZERO performance impact with storage and CPU in case of containers, there is an impact in networking, but i assume, this is not applicable here
Databases and database management systems must be optimized in special ways, there is no "install and run" approach. We, sysadmins/db admins usually need days to have it running smoothly. Also, performance changes over time.
After couple of weeks of testing and troubleshooting. I finally got the answer and I shall share my findings with the rest of the DevOps or anyone who facing the same issue as me
Correct this statement if needed, Docker Container was started off with Linux, Microsoft join the container bandwagon late and in order to for the container works (with Linux), the DevOps team need to install Linux WSL2 in Windows. And that cost extra overheads which resultant in the process speed.
So to improve the performance speed with containers, the setup should be in Linux OS instead of Windows OS. (and yes the speed reduce drastically)

Is it possible to have a Kafka cluster with different OSes?

If I have one Kafka running on Windows server, and another Kafka running on Linux server, and the last one running on a Unix server, can I use those three as one cluster?
Server A - Windows
Server B - Linux
Server C - Unix
Can I use them for replication? As in --replication-factor 3?
Brokers communicate via well defined APIs that don't depend on the operating system, so in theory that should work. However, I doubt anybody has tried running such a cluster!
It's worth noting that Windows is not an officially supported platform: http://kafka.apache.org/documentation/#os so you may run into a few issues.
I'm not sure why you'd even consider doing this as this sounds like an operation nightmare! For science!

how can we run multiple mongodb versions on same system?

How can i run mongo 2.6 and mongo 3.0 at the same time on my linux system ?
I need this because i have 2 projects one is working on mongo 2.6 and one is working on mongo 3.0
Any help is appreciated !!
If you really wan to do this, and I recommend you DO NOT, then the best way is to use a container tech, docker can work quite well or LXC or one of the others.
However, do note that there is a high chance that if your sever is in the "cloud" it is already vitualised as it is as such you will constantly be losing power and resources due to sub virtualising everything over and over.
DO NOT put them on the same host without some kind of separation there will be a high chance of resource contention and conflict that tools like ulimit just cannot solve (well, technically it could but it will be a hairball).

Mongodb sharding is NOT recovered after power off accident

I'm running 4 vms (centos) on a single machine (Windows 2008 R2). The 4 vms are setup as below:
1 mongos
1 mongo configure server
2 mongod as sharding servers
OK, everything was fine before a power off accident. When the power came back, I did manually reboot all the VMs, and found the sharding setting is gone. I mean, the mongos can talk to the configure server, but somehow the sharding data is lost and it show the database is not sharded.
I setup the sharding based on documents from mongodb websites (e.g. running some command in mongo shell to enable sharding for the db and each collection). Do I need to do all the mongo shell commands again after rebooting? Or is it supposed to recover automatically once the sharding is enabled?
Thanks.
Once you've established a sharded cluster, it is certainly supposed to stay configured, even if servers fail, even if they all fail at the same time. Restarting the servers should bring everything up just the way it was before the outage. Based on your description, it is difficult to reason what might have gone wrong. A dump of the config database, and the log files of all the affected servers, would be necessary to analyze what happened. This should perhaps be filed as a ticket with MongoDB support.
(It is, by the way, recommended to run three config servers rather than a single one, for availability reasons. But even so, even a single server should recover just fine after having failed. The three-server recommendation is only to make sure that there's always a live config server even if one of them should fail.)

Should I use VirtualBox on a production server?

I just completed my vagrant box for a product that made by my company.
I needed that because we're running same product on different
operating systems. I want to serve sites inside virtual machines, I
have questions:
Am I on correct way? Can a virtual machine used as production
server?
If you say yes:
How should I keep virtualbox running? Are there any script or sth
to restart if something crashes?
What happens if somebody accidentally gives "vagrant destroy"
command? What should I do if I don't want to lose my database and user
uploaded files?
We have some import scripts that running every beginning of the
month. sometimes they're using 7gb ram (running 1500 lines of mysql
code with lots of asynchronised instances). Can it be dangerous to run
inside VirtualBox?
Are there any case study blog post about this?
Vagrant is mainly for Development environment. I personally recommend using Type 1 hypervisor (Bare metal), VirtualBox is a desktop virtulization tool (Type 2, running on top of a traditional OS), not recommended for production.
AWS is ok, the VMs are running as Xen guest, Xen is on bare metal;-)
I wouldn't.
The w/ Vagrant + Virtualbox is that these are development instances. I would look at Amazon Web Services for actually deploying your project into the wild.