MySQL V/s MONGO Basics



Here are some basic comparison b/w MySQL and Mongo .


MYSQL
MONGO


mysqld : Database Server program or daemon



monogd : Database server program or daemon
mysqld listens on Default PORT : 3306

Version: '5.1.61'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

mongod listens on Default PORT :27017

NETWORK  [initandlisten] waiting for connections on port 27017

mysql is the client tool
mongo is the client tool
Mysql stores data in TABLES and ROWS
Mongo Represents data as COLLECTIONS and Documents
/etc/my.cnf is the standard configuration file
/etc/mongod.conf  is the standard configuration file

Lists Databases

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)
MySQL>



Lists Databases

MongoDB Enterprise > show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
MongoDB Enterprise >
To switch b/w database

mysql>
mysql> use test
Database changed
mysql>
To Switch b/w database

MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise >




MySql command line options

Mysqld --datadir
       --log-error
       --basedir

Mongod command line options

Mongod --port <portnumber>
       --dbpath <Location for datafiles>
       --logpath <location of logfile>
       --fork

MySql uses options file also called as configuration file to specify commonly used options so that they need not be entered every time on the command line .

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@mysql ~]#

Mongo uses YAML (Yet Another Markup Language) file as options files with key value pairs for defining the options .

storage:
  dbPath: "/var/mongodb/db"
systemLog:
  path: "/data/log/mongod99.log"
  destination: "file"
net:
  bindIp : "127.0.0.1,192.168.100.100"
  port : 27000
processManagement:
  fork : true
Backup & Restore Tools

mysqldump
mysqlhotcopy
mysqlimport

Backup & Restore Tools

mongoexport
mongoimport
mongodump
mongorestore

No comments:

Post a Comment

Change Private IP Network Interface /Subnet/Netmask

Scenario: 1 In this scenario, I am replacing the private interface eth2 with the new interface eth3 and also change in subnet ...