I'm triying to connect from my linux terminal (Linux Mint 17) to a remote mongodb database in mongohq. I try using this command:
mongo arrow.mongohq.com:port/cac-test –u userhere -p passwordhere
But isn't work. I just got this message: connecting to: arrow.mongohq.com:27043/database-name-here
loading file: –u
2015-05-07T10:27:57.645-0600 file [–u] doesn't exist
failed to load: –u
I don't know what is the problem. I read in other places but I can't figure it out.
Maybe someone can help me, if exist any procedure to connect, some other commands or configurations.
Thanks.
Related
I am trying to install thingsboard PE instance on Ubuntu 18.04.3 LTS
while I run this command
sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo
I am facing the following error
Error: Could not find or load main class org.springframework.boot.loader.PropertiesLauncher
ThingsBoard installation failed!
the thingsboard.log file is not present in /var/log/thingsboard
Can anyone please suggest me what's the reason for this error?
Make sure the thingsboard database does actually exist. I had the same error. I did follow the instructions, but possibly the CREATE DATABASE was not followed by ';' or it needed to be started.
Restart the ubuntu server.
Log in and log onto PSQL: psql -U postgres -d postgres -h 127.0.0.1 -W
Check for existence of the database: \list
If it does not exists, run: CREATE DATABASE thingsboard;
Run \list again and make sure it exists. Quit by running \q.
Re-run the demo create script: sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo
Happy Thing-ing.
Along with the above as Antony Horne has suggested, also you can remove the ThingsBoard related directories under /tmp/. Remove and recreate the 'thingsboard' database. Make sure to set the password as 'postgres'. Then re-run the command
/usr/share/thingsboard/bin/install/install.sh --loadDemo
It should be fine.
Though after that, when I tried to run the 'thingsboard' as
service thingsboard start
Its is not working as 'thingsboard' is unrecognized. Couldn't solve that yet.
A while ago I created a Ruby on Rails project with a postgres database. It was originally created on a macbook where I had set up a working production and test environment. Unfortunately, this computer has died and now I have to continue working on the same project using the only machine I have: a Windows 10 laptop.
I have been following these guides to set up a viable rails environment on my windows 10 pc:
https://medium.com/#colinrubbert/installing-ruby-on-rails-in-windows-10-w-bash-postgresql-e48e55954fbf
https://gorails.com/setup/windows/10
I have installed bash/ubuntu successfully. I have installed git successfully. I have installed ruby successfully. I have installed all the pre-requisite gems so that I can run bundle install successfully. When I get to postgres, as suggested by both tutorials, I install it via windows instead of installing it by terminal. With Postgres 9.6 installed and running as a windows service, I'm unable to enter psql in the terminal. I get this error:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Additionally, here are the errors that appear when I attempt to do something with rake db commands:
FATAL: role "xxx" does not exist
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"YelpClone_development", "host"=>"localhost"}
rake aborted!
ActiveRecord::NoDatabaseError: FATAL: role "xxx" does not exist
'xxx' above is my username. I'm not sure if its the username from my old mac or on my new windows machine. I've attempted to edit the database.yml inside my rails project but that gets the same results.
Looking at this topic about the role error, I attempted to use the command "sudo -u postgres -i" which results in another error:
sudo: setresuid() [1000, 112, 1000] -> [-1, 0, -1]: Operation not permitted
sudo: unable to set runas group vector: Operation not permitted
sudo: unable to mkdir /var/run/sudo: Permission denied
[sudo] password for xxx:
sudo: PERM_ROOT: setresuid(0, -1, 0): Operation not permitted
xxx is not in the sudoers file. This incident will be reported.
Once again 'xxx' is my username. Now I'm beginning to suspect that all this stuff did NOT install correctly. But I'm unsure how I can check. I've tried re-installing postgres about 5-6 times now. Can anyone shed some light on this mess?
I have found a solution to this problem and I thought I would post how I solved it in case anyone else had the same issues:
I followed the instructions found on this page for issues specific to the WSL (Windows subsystem for Linux), specifically posted by user leafofLegend.
The main problem I had was getting stuck on step 7. I had to downgrade my postgres install to 9.3 in order to have PGAdmin 3 instead of 4 as it no longer has editing features for server config. The 2nd issue was being unable to access the ~/.bashrc file. I attempted to open it in atom (via terminal) but it would show me a blank file each time. Alternatively, if I navigated to the file on windows and opened it there, it would become corrupted and not source to the terminal properly. You CANNOT edit linux files using windows tools. Therefore I had to use nano editor to edit the ~./bashrc file as stated in step 9.
The above steps solved the bulk of the problem, which was getting a windows installed PG to be friendly with a WSL terminal. Following the rest of the steps, I'm now able to run rake DB commands and create new dbs.
I download the boot2docker#1.7.1 and install it through the package wizard. But when I try to run it, it throws me this error:
An error occurred trying to connect: Post https://192.168.59.103:2376/v1.19/containers/create: remote error: bad certificate
I tried with all this options, but the issue remains.
You could try running boot2docker shellinit to set up your certificates and print some commands to be executed before you run anything using the docker command.
On a Mac it would look similar to:
Writing /Users/xyz/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/xyz/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/xyz/.boot2docker/certs/boot2docker-vm/key.pem
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/xyz/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
Here you could simply run $(boot2docker shellinit) to set up everything properly.
On Windows you will have some SET commands to issue instead of those export commands. For further information for Windows users please refer to the boot2docker documentation.
I'm following though with the RailsApp tutorial with Devise and Mongoid (http://railsapps.github.io/tutorial-rails-mongoid-devise.html) and am encountering the following error when I get to 'Rake db:seed' down at the 'Set Up a Database Seed File' section.
Could not connect to a primary node for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]>
I've tried the instructions from nixoncd on this page here but has not fixed the issue. It tells me 'file exists' and 'Already loaded'. 'https://groups.google.com/forum/#!topic/mongodb-user/Hhh8iNCciMk
I get this if I type 'mongod' in terminal.
ERROR: could not read from config file
Any help welcome. I'm on a Mac OSX Mountain Lion with Mongoid installed using homebrew - though MongoDB was installed using the download package mongodb.org.
MongoDB shell version: 2.4.6
Thanks
EDIT: I'm not sure if this issue is related or not. Also having issues launching mongoDB. Also posted issue here:
mongoDB, could not read from config file -- config in different folder / Uninstall it?
First See if your database is running by mongo , If yes
Use this command:
sudo rm /var/lib/mongodb/mongod.lock
mongod --repair
sudo service mongodb start
Your database will work.
Installing MongoDB solved this for me:
sudo apt-get install mongodb-server
The answers above will work for you in the majority of the cases where this error occurs.
However, I would like to note that you can also get the Could not connect to a primary node for replica set error when trying to write exceptionally large batches of records to MongoDB in one request. I have encountered this error when writing more than 200,000 1 KB documents to a remote MongoDB server with in one request. The remote server had 8 GB memory and would handle several requests at once. This error can be avoided by cutting down the batch size of your requests.
I get the error below when trying to start my rails app on the localhost:
PGError (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"?
From what I have read it sounds like this is most likely a problem in connecting to the Postgres server, and may indicate that it is not started?
It all started when I was attempting my first (yay noobs!) merge using git. There was a conflict (having to do with the Rubymine workspace.xml file), and I started to open up a conflict resolution program. It then seemed that there was really no need to track workspace.xml at all and so I quit from the resolution program, intending to run "git rm --cached" on the file. I think in quitting the program something went foul, and I ended up restarting, before untracking the file, and then completing the merge. Further evidence that something was gummed up is that my terminal shell didn't open up correctly until I restarted the machine.
Now, as far as I can tell, everything in the merge went fine (there were trivial differences in the two branches anyway), but for the life of me I can't seem to get rid of this PGError. If it is as simple as starting the server, then I'd love help on how to do that.
(other context: OSx, rails 3, posgresql83 installed via macports, pg gem).
EDIT - I have been trying to start up the server, but am not succeeding. e.g., I tried:
pg_ctl start -D /opt/local/var/db/postgresql83/defaultdb
This seems to be the right path for the data (it finds the postgresql.conf file) but the response I get is "cannot execute binary file."
Try sudo port load postgresql83-server - this should work with the latest 8.3 port from macports.
If this doesn't work, try sudo port selfupdate; sudo port upgrade outdated and then try again.
Note - this may take absolutely ages.
and may indicate that it is not started?
Yes, sounds like the server is not running on your local machine.
See the description of this error in the PostgreSQL manual:
http://www.postgresql.org/docs/8.3/static/server-start.html#CLIENT-CONNECTION-PROBLEMS
To start the server, try something along the following lines (adjust for pgsql version # and logfile):
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql8/defaultdb -l /opt/local/var/log/postgresql84/postgres.log start'
To stop the server,
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql84/defaultdb stop'