MongoDB installation in AWS EC2 RHEL

Hi Team,

We have a requirement to load a text file (fixed width file) to mongodb. We are trying to connect to remote mongodb (mongodb+srv://servername) from bash shell script which resides in AWS RHEL EC2. Below are the steps followed. But after doing that when I type mongo or mongosh it mentions as command not found(-bash: mongosh: command not found). Could you please let me know what is missing here?

  1. Installed mongodb mongodb-org-shell-5.0.6-1.el8.x86_64.rpm
    yum install mongodb-mongosh -y
  2. Start and enable Mongo - systemctl restart mongod, systemctl enable mongod

Thanks,
Shajila

Hi @Shajila_KP,
Have you the binary of mongo under the directory /usr/local/bin?

Regards

Can you tell me what is the binary file name? I dont see anything related to mongodb there

Hi @Shajila_KP,
these are the binaries + database tools:
image
and you need to see if they are present in one of the paths defined by the command:
image
because the operating system, is in one of these paths that goes to look for the executable that you tried to launch

Regards

1 Like

Thanks… Let me check this and get back

1 Like

Welcome to the MongoDB Community Forums @Shajila_KP!

It looks like you have installed the mongodb-mongosh package, so as @Fabio_Ramohitaj suggested you need to ensure the executables can be found in your $PATH variable.

The SRV (DNS Seed List Connection Format) gets some connection details from SRV and TXT records configured in the DNS for the provided server name.

If you have not set up any DNS entries for a self-hosted installation, you should be using the standard connection string format which will start with mongodb://.

Regards,
Stennie

1 Like