Posts

Showing posts from December, 2020

initdb in PostgreSQL

  Initdb is used to create a new PostgreSQL database cluster refer to the PostgreSQL documentation for more information.  https://www.postgresql.org/docs/9.5/app-initdb.html Syntax:  initdb -D <directory location> Steps to create a new database cluster: 1. Create a required directory and make sure it has proper permissions and ownership mkdir -p /u02/client1 -bash-4.2$ ls -ld /u02/client1 drwx------. 15 postgres postgres 4096 Dec 28 20:06 /u02/client1 2. Create the new database cluster using initdb -bash-4.2$ initdb -D /u02/client1 The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". fixing permissions on existing directory /u02/client1 ... ok creating subdirectories ... ok sele...

Devops

Maven Maven is an Open Source, Java-based build tool and developed by Apache. Maven is a powerful project management tool that is based on POM (project object model).  It is used for project build, dependency, and documentation. Different build tools: Java           -> ANT/Maveen/Gradle .Net            -> Nant/MS Build Python      -> PyBuilder Ruby          -> Rake Using Jave can be developed 3 different types of applications: a) Standalone Applications: Types of packages: jar (Java Archive) Examples: .java  .class .jar b) Web Applications Types of packages: war (Web Archive) Examples: Java Code + Web content (Html, CSS, JS, Images) - static contents c) Enterprise Applications Types of packages: ear (Enterprise Archive) Examples: How to run the java class "welcome.java"? Step-1: compile the .java file using javac javac welcome.java .jav files are human-readable forma...

Shell Scripting

                                        Basic Shell Scripting Basic Linux commands: File descriptors <, >, >>, 1>, 2>, 2>&1, &> <   Defaults to a success output >    Write the output to a new file if doesn't exist and if the file exists it truncates or overwrite the       content of the file and write the new content to the file. >> Write the output to a file if doesn't exist and if the file exists it appends the output into it. 1>   Success output  2>   Error output STD INPUT/OUTPUT options:   1>file_name 2>file_name       -> Success and error output into same or different file_name 1>file_name 2>&1             ->  Error out will be stored where you success output stores &>f...

Upgrade MongoDB cluster from 3.4 to 3.6 on Linux environment

This document using a "rolling" upgrade to minimize downtime by upgrading the members individually while the other members are available Starting in MongoDB 3.6, mongod and mongos instances bind to localhost by default. Remote clients, including other members of the replica set, cannot connect to an instance bound only to localhost. To override and bind to other ip addresses, use the net.bindIp configuration file setting or the --bind_ip command-line option to specify a list of ip addresses. The upgrade process will require that you specify the net.bindIp setting (or --bind_ip), if your replica set members are run on different hosts or if you wish remote clients to connect to your replica set. Read Concern Majority:    Starting in MongoDB 3.6, MongoDB enables support for "majority" read concern by default. For MongoDB 3.6.1 - 3.6.x, you can disable read concern "majority" to prevent the storage cache pressure from immobilizing a deployment with a primary-s...

rs.stepDown() in MongoDB replication

It instructs the primary of the replica set to become a secondary. After the primary steps down,the eligible secondaries will hold an election for primary. Generally, the rs.stepDown() does not immediately step down the primary. If no electable secondaries are up to date with the primary, the primary waits up to secondaryCatchUpPeriodSecs (by default 10 seconds)  for a secondary to catch up. Once an electable secondary is available, the method steps down the priamry.  Once stepped down, the original primary becomes a secondary and is ineligible from becoming primary again for the remainder of time specified by stepDownSecs. The rs.stepDown() method attempts to terminate long-running user's operations that block the primary from stepping down, such as an index build, a write operation, or a map-reduce job. Syntax: rs.stepDown(stepDownSecs, secondaryCatchUpPeriodSecs)

Default MongoDB Ports

27017 -> The default port for mongod and mongos instances. You can change this port with --port option 27018 -> The default port for mongod when running with --shardsvr command-line option or the                  shardsvr value for the clusterRole setting in a configuration file. 27019 -> The default port for mongod when running with --configsvr command-line option                  or the configsvr value for the clusterRole setting in a configuration file.