My mongoDB is not working it execute error - database

W NETWORK [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed
I expect to work this mongodb

Windows environment:
If you are using on localhost then start the mongod process, from the bin location(the location where you installed mongodb)
"C:\Program Files\MongoDB\Server\6.0\bin\mongod.exe" default path location
keep this terminal running, do not close it
After that open the mongo shell, download from offical mongodb website install it, and connect your localhost
in Linux environment :
Maybe your server might not be working, restart the service.
As you are not able to log in to the system so kill the process.
in linux terminal:
ps -ef | grep mongo
get the process id number, then kill the process
kill pid_number
After that start it from its config file
in terminal pass this command, and change the path of mongod.conf file if it is not installed on default location.
mongod --config=/etc/mongod.conf
(this one is default path)
Hope this will work.

Related

Why do check_nrpe not work in remote server?

I installed Nagios to my local server, and am monitoring a CentOS server.
All the plugins (nagios plugins and nrpe) are installed too, and working in local, but not via my server. Generic services are monitored well but others (local services) aren't working. Statut information shows: CHECK_NRPE STATE CRITICAL: Socket timeout after 30 seconds.
I've installed nrpe in my remote host and added commands in nrpe.cfg.
In my nagios server, I defined those commands in my server's configuration file.
When I check those commands in my centOS server, it works well.
For exemple when I type:
./check_procs -w 250 -c 300
prompt shows:
PROCS AVERTISSEMENT: 284 processus | procs=284;250;300;0;
Or the command: ./check_nrpe -H localhost
It shows: NRPE v3.2.1
Everything seems working, but if I try: ./check_nrpe -H monitoredserver, it doesn't work.
Also, in nagios web interface, every local service in monitored server shows: CHECK_NRPE STATE CRITICAL: Socket timeout after 30 seconds.
Please verify common mistakes which you can have:
Your NRPE daemon is not started on remote server
Run service nrpe status on remote server and verify NRPE state.
Test your network connection
Run telnet monitoredserver 5666 from Nagios server and test your connection. If this command fail, then you have firewall between these servers.

How do i resolve "Failed to parse remote port from server"

I'm setting up a new remote host and every time i initiate it i get the following error output: Any feedback or direction on how to resolve this issue?
Pseudo-terminal will not be allocated because stdin is not a terminal.
Linux Destiny 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1 (2019-04-12) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
mesg: ttyname failed: Inappropriate ioctl for device
bash: cannot set terminal process group (3202): Inappropriate ioctl for device
bash: no job control in this shell
mesg: ttyname failed: Inappropriate ioctl for device
Installing...
Downloading with wget
WARNING: tar exited with non-0 exit code
Found running server...
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
*
cat: /root/.vscode-remote/.473af338e1bd9ad4d9853933da1cd9d5d9e07dc9.log: No such
file or directory
Server did not start successfully. Full server log:
cat: /root/.vscode-remote/.X.log51ec4692-
4da4-4ec0-b613-5a3563034cf1====
: No such file or directory
"install" terminal command done
Received install output: : No such file or directory
Failed to parse remote port from server output: : No such file or directory
If the server fails to shut down properly, sometimes it leaves dangling lockfiles. This can cause startup to fail and produce the "Failed to parse remote port from server output" error message. In this case the solution is to simply to delete the lockfiles:
.vscode-server/bin/[:xdigit:]*/vscode-remote-lock.*
Fixed the issue. It appears I had 2 other server agents running incorrectly. I killed both server agents using kill (PID) and removed ".vscode_remote" directory from user home directory. Then i reinitialized remote-ssh from vscode. Successfully connected!
On remote machine you do not have a tar installed. It's in log output
Installing... Downloading with wget
WARNING: tar exited with non-0 exit code
so under a root run:
apt-get install tar
or with sudo, if you have a user with sudoers configured:
sudo apt-get install tar
I also got the same issue and my workaround was to provide proper rights to the home or user folder, so vscode can create a remote folder and do the required installation on it.
Example :
sudo chmod -R 777 home/
In this case, I have provided all rights to my home folder and It worked like a charm for all the users.
I ssh'd onto the remote server (linux) and then deleted both directories as follows:
$ rm -r .vscode-server.backup2022-04-03T16:20:18-05:00
$ rm -r .vscode-server
In case someone else encounters the same issue - I had an instance where remote target had no space left on device. After extending root volume of target machine, connection worked fine.
I had the same issue because vscode was looking for my .vscode-server directory in the wrong location (it was in a custom location due to restrictions on where files can be saved). This can be fixed by using How to change vscode-server directory. Specifically add:
"remote.SSH.lockfilesInTmp": true,
"remote.SSH.serverInstallPath":{
"hostname":"/path/to/.vscode-server/.."
}
To your settings.json
In my case, it wasn't working because of server asking for new password when starting a session. What I did was to open a new default terminal (not VSC terminal but your OS default terminal like ZSH, CMD, and so on). And I used the ssh command to login. I logged in successfully and changed the password. Then I tried connecting with the new password and it worked because the server didn't asked for password change now.
Command:
ssh username#IP
Enter password and you'll get asked to change the password. Change the password and try connecting again with new password using SSH VSC extension.
If yout authorize by ssh-key - also check the value of User parameter in VsCode ssh config. User must have matching key in ~/.ssh/authorized_keys on remote host.
#Sachin's answer directed me in the right direction, VSCode needs permissions in order to create some files, but instead of giving 777 permissions to your home folder (which can be dangerous) you can just chown the user that wants to log in (the user for me was ubuntu):
sudo chown -R ubuntu /home
I also got the same issue and my workaround was to provide proper rights to the home or user folder, so vscode can create a remote folder and do the required installation on it.
Step 1: Add port to your config file :
Host hostname
Port 22
User username
Step 2 : Go to File->Prefrences ->Open settings.json fle
Search for lockfilesInTmp
and check the box next to that

Cant connect to oracle db in docker with squirrel-sql

I tried to connect to oracle db 11 in docker (https://hub.docker.com/r/sath89/oracle-xe-11g/).
Started docker with command:
docker run -d -p 8080:8080 -p 1521:1521 -e DEFAULT_SYS_PASS=sYs-p#ssw0rd sath89/oracle-xe-11g
From this description:
hostname: localhost
port: 1521
sid: xe
username: system
password: oracle
made an url - jdbc:oracle:thin:#192.168.99.100:1521:xe
With squirrel-sql have an error:
class java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-12705: Cannot access NLS data files or invalid environment specified
But if I try to connect with SQLplus thats ok:
docker exec -ti oracle_id sqlplus bash
sqlplus
The SquirrelSQL needs to have some NLS variables set before logging in. For the Docker connection, note that you have "bash" at the end of your command. This not only tells the connection that you'll be using bash shell, it sets up the environment to connect using the bash_rc, (and possibly a profile, too). You're coming from your local machine vs. an SSH, so the local machine is being used instead of the SSH.
I believe there is a squirrel-sql.bat file that could unset and then set the environment or better yet, let's just unset it in the registry and let the local connection take its course:
On your Windows maching:
Do a search for an NLS_LANG subkey in the registry: \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, rename it, save the change, reboot and retry.
I’m not familiar with Squirrel SQL, but you may also be missing a proper set up of the jar files. Look and see if your jar files are configured correctly, depending on your version, its going to look something like this:
%Oracle_\jdbc\lib\ojdbc.jar

Unable to mount data directory in MSSQL RC1 server setup in linux

I'm trying to change the default data directory for MSSQL Server RC1 2017 after installation and setup in linux (Ubuntu-16.10).
I used the following command to set the default data directory. Then restarted the mssql server.
sudo /opt/mssql/bin/mssql-conf set filelocation.defaultdatadir /mnt/var/opt/mssql/data/
systemctl restart mssql-server.service
After this I tried to create a simple database "test"
sqlcmd -s localhost -U sa -P "someStrongPassword" -Q "CREATE DATABASE test"
The error returned is as follows:
MODIFY FILE encountered operating system error 31(A device attached to
the system is not functioning.) while attempting to expand the
physical file '/mnt/var/opt/mssql/data/test.mdf'.
CREATE DATABASE
failed. Some file names listed could not be created. Check related
errors.
The error log indicates an OS error:
/mnt/var/opt/mssql/data/test.mdf: Operating system error 31(A device
attached to the system is not functioning.) encountered.
I cannot mount the data directory by any means. The permissions to "/mnt" directory are set to 777 too. Changing the default data directory to any other folder, works perfectly fine. Is this a known or recent bug with mssql server?
Yes, there is an issue with using remote storage through NFS and SMB that came up in CTP 2.1 and was not yet fixed in RC1. See release notes: https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-release-notes#a-idrc1-rc1-july-2017-a
The only workarounds are to use local storage or CTP 2.0. We are working on a fix. Release ETA is TBD ATM.

cannot start psql (postgres) on mac 10.8.5

Here is what I get when I try to access psql from console. I am using homebrew to run postgres.
atul-new-mac:sites user$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I checked the version by this:
atul-new-mac:sites user$ which psql
/usr/local/bin/psql
Here is the detail from the log file:
atul-new-mac:sites user$ tail -f /usr/local/var/postgres/server.log
ERROR: could not access status of transaction 0
DETAIL: Could not open file "pg_clog/0000": Permission denied.
LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
PANIC: could not open control file "global/pg_control": Permission denied
LOG: checkpointer process (PID 381) was terminated by signal 6: Abort trap
LOG: terminating any other active server processes
LOG: could not open temporary statistics file "pg_stat/global.tmp": Permission denied
LOG: abnormal database system shutdown
This is what I get when I try to start it manually:
atul-new-mac:postgres user$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl: another server might be running; trying to start server anyway
server starting
sh: /usr/local/var/postgres/server.log: Permission denied
Your log tells that your postgresql instance is having trouble with permissions (lines ERROR and PANIC) and reading other extracts you give, you may already have a postgresql instance running.
To check it, just do this command:
ps aux | grep -i "*postgres*"
You should see all postgresql processes running.
Try to stop all thoses processes either by using pg_ctl stop or if nothing happens and the processes are still there, then try to kill them (I presume you're on a development platform, so that should not cause a problem for others)
kill -9 <postgresID>
Then when all the postgresql processes have disappeared, then try to start postgresql. If you're still having a permission problem, use lsof tool to see which process is locking your files.

Resources