Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I uninstalled mongo after configuring a 3 set replica when the limit of virtual memory exceeded. After that I tried to start my mongo replication and couldn't get these commands to work.

rs.initiate() rs.reconfig()//with config params

Last replica set had primary(27017),secondary(27018,27019) After reinstalling I got back the secondary to work but my primary is stating

no replica set conf has been found.

How to deal with this issue?

1 Answer

0 votes
by (11.7k points)

Follow these commands to configure the MongoDB replica set:

grep -rnw '/path/to/somewhere/' -e 'pattern'

  • -r or -R is recursive,

  • -n is line number, and

  • -w stands for match the whole word.

  • -l (lower-case L) can be added to just give the file name of matching files.

  • -e is the pattern used during the search

Along with these, --exclude, --include, --exclude-dir flags could be used for efficient searching:

  • It will search for those files which have .c or .h extensions:

grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"

  • It will exclude searching all the files ending with .o extension:

grep --exclude=\*.o -rnw '/path/to/somewhere/' -e "pattern"

  • One or more directories can be excluded using --exclude-dir parameter. For instance, it will exclude the dirs dir1/, dir2/ and all of them matching *.dst/:

grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 19, 2021 in Web Technology by adhiraj (4k points)
0 votes
1 answer
asked Mar 26, 2020 in AWS by chandra (29.3k points)

Browse Categories

...