Will Homebrew install of mongodb overwrite existing databases? - mongodb

I want to reinstall mongodb on my mac using the following commands:
brew tap mongodb/brew
brew install mongodb-community
If I do this, will I lose the current databases in my existing mongodb install?
Edit
To clarify, the previous installation was done via HomeBrew as well.

It depends on where your existing database files are stored, whether mongo was installed via Homebrew previously, and if so, which version was installed.
Homebrew will install mongodb into /usr/local/Cellar/mongodb-community/{version} (4.4.0 as of this writing) and symlink the binaries into /usr/local/bin. It will not modify an installation performed by another means and any existing databases will be untouched as long as they're not in the same path as this installation. You would be able to load them with the Homebrew version with no issues.
You will need to consider your $PATH if you plan to leave both mongodb versions installed - if the Homebrew path (/usr/local/bin) is after the path of your current installation then the old binary will run. Homebrew usually takes care of this for you, but something to watch out for if you have any strange behaviour. Check the location of your current binaries by running which mongod.
To stay on the safe side, you should make a copy of your existing data files before you [re,un]install.

Related

FreeBSD: upgrade MongoDB server from 2.6 to 3.0

Running MongoDB v2.6 Server on FreeBSD operating system, I am looking for a way to upgrade the MongoDB version to at least v3.0. According to MongoDB website, I need to replace the binaries but I am not able to find appropriate download binaries for FreeBSD there MongoDB download website. Alternatively I had hoped, I could upgrade the binaries using pkg package manager but I don't know which command to use to upgrade to a specific version. I am looking for something like:
pseudocode:
sudo pkg upgrade mongod v3.03
I've been crawling the web for days now to find a download link for Freebsd binaries for Version 3.0x or right upgrade command using pkg package manager.
Solution is: using the command "pkg install mongodb36-3.6.6_2" as suggested in the link by Valijon will first deinstall a previous version and then install v3.6 of MongoDB Server. Just what I was looking for.

Why MongoDB folder is not generated inside programs files after successfully installation at windows 10?

I am trying to install MongoDB inside my machine as a local , after install the installation exe of MongoDB but MongoDB folder did not generated even checked inside programs files and x86 also in both.
Please help me out what should i try to install it successfully.
See MongoDB 3.6.2 2008R2 Plus Not Installing - basically during install you need to uncheck the "Install compass" option for some reason. Not sure why, but installing without Compass works.

Upgrading older mongo database after unintentional mongo version upgrade

Is there any way to upgrade a mongo database after the mongodb package was unintentionally upgraded (3.4.9 -> 3.6.1)?
According to the mongo docs, as a prerequisite of the upgrade, featureCompatibilityVersion has to be set from the mongo cli tool, which, however, needs a running mongod database daemon, which, however, won't run if mongodb package was already upgraded and the database was not set the featureCompatibilityVersion flag.
I'm on ArchLinux, I had mongodb in IgnorePkg but it's dependencies boost-libs and wiredtiger got upgraded anyways. Having pacman cache already wiped out, I compiled older versions of the packages myself, but running mongodb keeps failing with this error:
unsupported WiredTiger file version: this build only supports major/minor versions up to 1/0, and the file is version 2/0: WT_ERROR: non-specific WiredTiger error
I don't have a clue what the hell this means (the problematic version of wiredtiger is 2.9.3-1, version after the upgrade is 2.9.3.20171205-2).
Seems like I can neither downgrade nor upgrade...
Other cli tools (e.g. mongodump) also won't run without a running database, is there any other possibility (some wiredtiger related tool)? Deleting the database and starting afresh is not an option.
I solved the problem by installing the older version of mongodb on a system for which it wasn't a problem to get it pre-packaged (well, Windows 10, even though oficially it's stated the package is for Windows Server 2008), copying the database files (contents of /var/lib/mongodb) there, running it with --dbpath param (mongod --dbpath /path/to/dbfiles), setting the compatibility flag according to the docs and finally copying the db files back to the server.
Would like to know about a better option, but it's good to know the db files are easily transferable to another system, even another architecture (the db was relatively simple and small though).
Running mongod --repair worked for me.
here similar issue, unintentionally upgrade from 4.2.1 to 4.4.3, then mongodb can NOT started..
Final worked solution:
uninstall (latest, but not worked version: 4.4.3)
brew uninstall mongodb-community
reinstall, old but worked 4.2.1
brew install mongodb-community#4.2
run
for now: brew services run mongodb-community#4.2
for now and set bootable: brew services start mongodb-community#4.2
check status
brew services

How to fix pg_dump version mismatch errors?

When trying to get local data to Heroku, I am encountering a version mismatch between two different versions of pg_dump.
Specifically, I am getting this message:
pg_dump: server version: 9.2.2; pg_dump version: 9.1.4
pg_dump: aborting because of server version mismatch
I have found others with this problem, but do not know enough to implement the proposed solutions. (I am new to Ruby on Rails, PostgreSQL, Heroku, and the Mac! Very much at the stage of playing around the picking things up as I go.)
I was thinking I might simplify my life if I uninstalled all PostgreSQL on my local machine and started again with a clean install of PostgreSQL 9.2.2 from http://postgresapp.com/, but I don't know how to go about doing the uninstall.
I'm running Mac OS X Mountain Lion 10.8.2.
OS X 10.8 comes with pg_dump version 9.1.4 in the /usr/bin directory, along with psql and other programs that are client-side PostgreSQL tools. It does not mean that PostgreSQL as a server is installed (unless you have OS X Server Edition).
So you don't have to uninstall PostgreSQL because it's not installed and it's better not to remove these postgres client tools in /usr/bin because they belong to the system as shipped by Apple. They just need to be side-stepped.
The package provided by postgres.app comprises both the PostgreSQL server and the client-side tools of the same version as this server. These tools get installed in /Applications/Postgres.app/Contents/MacOS/bin
To use these instead of the 9.1 ones from Apple when you work in a Terminal, postgres.app documentation says to do:
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
and put it in your .profile file.
Once you have done that and you run pg_dump, you should no longer get the error that's it's the wrong version, because it would be the one that ships with postgres.app (currently 9.2.2).
I have this setup and it works OK for me.
If you only need to upgrade your pg_dump to the latest version and you have homebrew and mac, if the app has the latest version and your local pg doesn't:
brew upgrade postgresql
If you're using postgresapp 9.3.x, the path is different. The following worked for me (courtesy of http://sigmyers.com/blog/2013/3/12/postgres-pgdump-version-mismatch-error-postgresapp-postgresappcom)
export PG_BIN_PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin/"
PATH=$PG_BIN_PATH:$PATH
Check here for the latest path: http://postgresapp.com/documentation/cli-tools.html
I'm running Mountain Lion Server. My PostgeSQL server is at version 9.2.1 and the default tools are at 9.1.5.
I had to use:
PATH="/Applications/Server.app/Contents/ServerRoot/usr/bin:$PATH"
to make it work.
Yep, sometimes if you run Postgres.app this may happen after upgrade. Make sure you restart your Postgres.app - it will update your PATH.
In my case I have postgresql installed via homebrew and the executables are here: /usr/local/opt/postgresql#9.6/bin
Or you copy the dump and restore executions to the /Applications/Postgres.app/Contents/SharedSupport folder
or in PdAgmin you point the PG bin Path (in properties -> binary Path) to the path of the executables of your postgre

Rails: moving development environment from windows(mingw32) to OS X mountain lion

I have a rails 3.2.3 application which I was developing on my windows machine using git_bash as cli and mingw32 as environment (installed this env using railsinstaller)and postgres as db.
But there were some problems with rmagick and couldn't use it, although minimagick was working as expected.
Now, I am going to move application to my new mac machine running OS X mountain lion.
I have installed rails 3.2.8 and ruby on OS X using rvm. what do I need to do to update my application to rails 3.2.8 and setup db and other gems, should I delete or not delete gemfile.lock and what gems I need to remove or add or change version no. etc.
I am new to rails, please help
thanks!
Should I install postgres using homebrew or download from http://www.postgresql.org/download/macosx/
which is a preffered way of installing postgres, pros and cons of these methods.
As long as you don't have any Windows/machine-specific code in your app, you'll just need to do bundle install.
Regarding Postgres, it doesn't matter where you get it from, as long as it's on your $PATH. If you're already using Homebrew, then it makes sense to just do brew install postgres.
Gemfile.lock gives A list of gems used to ensure that all copies of the app use the same gem versions.
since I'm the only one working on this app and it's not yet in production. So, for me it makes more sense that I nuke Gemfile.lock and specify updated versions of gems I want now.
Things I did
Copied my application directory from my windows machine after cleaning some data in my tmp/ directory( tmp/ directory had 100M of data).
Installed imagemagick using brew install imagemagick
Installed postgresql using brew install postgresql
Generated a sample app using rails new blog -d postgresql
Changed database.yml file according to postgresql, as it required my mac user to be the username.
run sample blog app, and it was working fine. created a scaffolding and entered data and everything was working.
copied content of Gemfile.lock from blog application and pasted in my application's Gemfile.lock
changed version of rails in my Gemfile from 3.2.3 to latest version 3.2.8. changed version of some other gems.Replaced 'minimagick' with 'rmagick'. (I had problem with installing rmagick gem on windows, minimagick gem somehow worked on windows with older version of imagemagick).
Changed database.yml.
run rake db:create:all to create all the db.
run rake db:migrate
Run bundle and it installed all the dependecies.
run rails s
Everything is working fine now :)