I want others to access mongoDB on my OS X, the firewall is off and my configuration file is like:
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /data/db
net:
bindIp: 0.0.0.0
port: 27017
and i start the service like
sudo mongod --config /usr/local/etc/mongod.conf
I can always access the database using mongo and mongo 127.0.0.1
but when i use mongo xx.xxx.xxx.xxx(my ip address)
the access fails with the report:
mongo xx.xxx.xxx.xxx
MongoDB shell version v3.4.17
connecting to: mongodb://xx.xxx.xxx.xxx:27017/test
2018-10-04T09:05:54.316+0800 W NETWORK [thread1] Failed to connect to xx.xxx.xxx.xxx:27017 after 5000ms milliseconds, giving up.
2018-10-04T09:05:54.317+0800 E QUERY [thread1] Error: couldn't connect to server xx.xxx.xxx.xxx:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:240:13
#(connect):1:6
exception: connect failed
I'm really puzzled here. Obviously it's a timeout but my network connection is ok. I used homebrew to install mongoDB, and i've tried every version from 3.0 to 4.0 and the result seems always the same. And Google didn't give any help.
Here is mongodb version and environment info.
root#Backup:~# mongod --version
db version v3.2.22
git version: 105acca0d443f9a47c1a5bd608fd7133840a58dd
OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64
What I did is to update
bindIp: 0.0.0.0 in both files: /etc/mongod.conf and /etc/mongodb.conf. After the service restart, I could be able to connect mongodb remotely.
Related
everyone. I have install clickhouse on Ubuntu. But when I am trying to start server:
sudo systemctl start clickhouse-server
nothing happen. Also I noticed that db doesn't listen default port 8123. For, instance commands below do not give any result:
sudo netstat -tulpn | grep clickhouse
sudo netstat -tulpn | grep 8123
When I try to start server 'clickhouse-client --password', I get:
ClickHouse client version 22.8.4.7 (official build).
Password for user (default):
Connecting to localhost:9000 as user default.
Code: 210. DB::NetException: Connection refused (localhost:9000). (NETWORK_ERROR)
Clickhouse status:
clickhouse-server.service - ClickHouse Server (analytic DBMS for big data) Loaded: loaded (/lib/systemd/system/clickhouse-server.service; enabled; ve> Active: activating (auto-restart) (Result: exit-code) since Wed 2022-09-07> Process: 10730 ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhous> Main PID: 10730 (code=exited, status=233/RUNTIME_DIRECTORY) CPU: 90ms
Clickhouse clickhouse-server.err.log:
11. _start in /usr/bin/clickhouse (version 22.8.4.7 (official build)). Will overwrite it 2022.09.07 11:42:23.694750 [ 21604 ] {} <Error> Application: DB::Exception: Caught Exception Code: 76. DB::ErrnoException: Cannot open file /var/lib/clickhouse/uuid, errno: 13, strerror: Permission denied. (CANNOT_OPEN_FILE) (version 22.8.4.7 (official build)) while writing the Server UUID file /var/lib/clickhouse/uuid
What about
sudo systemctl status clickhouse-server
sudo tail -300 /var/log/clickhouse-server/clickhouse-server.err.log
sudo tail -300 /var/log/clickhouse-server/stderr.log
I am trying to connect to our AWS DocumentDB, but it fails with the following error:
2019-12-04T17:46:52.551-0800 W CONTROL [main] Option: ssl is deprecated. Please use tls instead.
2019-12-04T17:46:52.551-0800 W CONTROL [main] Option: sslCAFile is deprecated. Please use tlsCAFile instead.
2019-12-04T17:46:52.551-0800 W CONTROL [main] Option: sslAllowInvalidHostnames is deprecated. Please use tlsAllowInvalidHostnames instead.
MongoDB shell version v4.2.1
connecting to: mongodb://insights-db-2019-08-12-18-32-13.cih94xwdmniv.us-west-2.docdb.amazonaws.com:27017/?compressors=disabled&gssapiServiceName=mongodb
2019-12-04T17:46:52.684-0800 E NETWORK [js] SSL peer certificate validation failed: Certificate trust failure: CSSMERR_CSP_UNSUPPORTED_KEY_SIZE; connection rejected
2019-12-04T17:46:52.685-0800 E QUERY [js] Error: couldn't connect to server insights-db-2019-08-12-18-32-13.cih94xwdmniv.us-west-2.docdb.amazonaws.com:27017, connection attempt failed: SSLHandshakeFailed: SSL peer certificate validation failed: Certificate trust failure: CSSMERR_CSP_UNSUPPORTED_KEY_SIZE; connection rejected :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2019-12-04T17:46:52.687-0800 F - [main] exception: connect failed
2019-12-04T17:46:52.687-0800 E - [main] exiting with code 1
The command I use:
mongo --ssl --host MY_DOCUMENT_DB_HOST_AND_PORT --sslCAFile MY_KEY_PATH --username MY_USERNAME --password MY_PASSWORD
A couple troubleshooting I already tried:
Sent the exact same command and key to another Mac OS X machine on the same network --> worked fine
Uninstalled and reinstalled my mongo app mongodb-community#4.2
Try adding the rds-combined-ca-bundle.pem certificate to your Mac, I had a very similar error when trying to connect to DocumentDb using localhost through a forwarded port, the command I ran is
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain rds-combined-ca-bundle.pem
I got this command from this answer
For those hitting this issue post 2020, see the last reply in this thread: https://forums.aws.amazon.com/message.jspa?messageID=936916
Mac OS X Catalina has updated the requirements for trusted certificates. Trusted certificates must now be valid for 825 days or fewer (see https://support.apple.com/en-us/HT210176). Amazon DocumentDB instance certificates are valid for over four years, longer than the Mac OS X maximum. In order to connect directly to an Amazon DocumentDB cluster from a computer running Mac OS X Catalina, you must allow invalid certificates when creating the TLS connection. In this case, invalid certificates mean that the validity period is longer than 825 days. You should understand the risks before allowing invalid certificates when connecting to your Amazon DocumentDB cluster.
To connect to an Amazon DocumentDB cluster from OS X Catalina using the AWS CLI, use the tlsAllowInvalidCertificates parameter.
mongo --tls --host <hostname> --username <username> --password <password> --port 27017 --tlsAllowInvalidCertificates
Basically, just ignore invalid certificates.
I'm trying to run Lando remotely to avoid consuming local resources. Sometimes I need to work on a laptop and lando+xdebug is a hungry beast.
Local
I don't have Lando running locally. I'm synchronizing my files using PHPStorm and Lando is running remotely.
Remote
I have a DigitalOcean droplet set up and running a Lando (drupal8) site. I can access the site and it's running as normal at:
http://165.xxx.xxx.xxx:ppppp
165.xxx.xxx.xxx, being the IP of the droplet and
ppppp, being the port that Lando (docker) exposes the container
.lando.yml
name: XXXXXX
recipe: drupal8
config:
php: 7.1
webroot: ./docroot
xdebug: false // overridden later
services:
appserver:
build:
- composer install
ruby:
type: ruby:2.4
run:
- "cd $LANDO_MOUNT && gem install compass"
tooling:
blt:
service: appserver
cmd: /app/vendor/acquia/blt/bin/blt
gem:
service: ruby
compass:
service: ruby
fix-compass:
service: ruby
cmd: "gem install compass"
.lando.local.yml
Since I don't want this config for my fellow developers
config:
xdebug: true
config:
php: .lando.php.ini
.lando.php.ini
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_host = localhost
xdebug.remote_port = 9002
xdebug.remote_log = /xdebug.log
xdebug.remote_mode = req
xdebug.idekey = PHPSTORM
PHPStorm Server
Host: localhost
Port: 9002
Debugger: Xdebug
Use path mappings (checked)
-- project --> /app
Steps I take to run this
Start listening for debug connections in PHPStorm
Create SSH tunnel with ssh -R 9002:localhost:9002 root#165.xxx.xxx.xxx
Refresh http://165.xxx.xxx.xxx:ppppp
Findings
Using lando php -i, I can see that xdebug is running (and all of my php.ini config is set) as it should, on port 9002.
Using nc -z localhost 9002 || echo 'no tunnel open', I can also tell that SSH tunnel is open for 9002, as it should be.
I don't get any prompt for incoming connections
Update:
Some progress when I forced 9002 open with:
sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 9002 -j ACCEPT
However, now I get this error
Log opened at 2019-08-20 02:54:17
I: Connecting to configured address/port: 165.xxx.xxx.xxx:9002.
W: Creating socket for '165.xxx.xxx.xxx:9002', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2019-08-20 02:54:17
So I've been experiencing this a few times this year. I originally solved this a few weeks ago by upgrading PHPSTORM from 2018.1 to 2019.1. It was indicated to me (on some thread on the internet) that the XML schema for the next version of xdebug was different. It worked immediately after updating. It seems though that this broke again in 2019.2.
The last time I got this to work was 2019.1.3. Best of luck!
Update: As I've continued to update both storm and php/xdebug, I've found that this has stabilized. It was all over the place for a while.
i have been facing a problem linking mongodb compass and and the online mongo atlas, but somehow when i type the mongoimport command complete with its parameters extracted from the "Command Line Options" in atlas account, it throws up the error connecting to the db server: no reachable server
I am running MongoDB enterprise version 3.0.15 for connecting compass and atlas account on windows 7 platform. I have tried various methods which are already described in some of the links
mongodb Failed: error connecting to db server: no reachable servers
mongoimport error - Failed: error connecting to db server: no reachable servers
mongorestore Failed: no reachable servers
including:
specifying the configuration file with net parameters adjusted to bind ip 0.0.0.0 and port 27017 as described in some threads on this error. Also note that my configuration file did not have any replication parameters, so removing replication parameters was out of the questions as it was suggested in some posts.
Explicitly specify/allow Inbound traffic in Windows firewall for port 27017
Reset the replication set, although i could not understand why i would need to do that in mongoimport case when my mongod instance is not even started using the --replSet rs0 command. Following link was followed for resetting the replset as it was suggested in some posts* (https://vitalflux.com/mongodb-how-to-reset-mongo-replica-set/)
and verified what ports mongo is listening in using db.serverCmdLineOpts() with output like this { "argv" : [ "mongod" ], "parsed" : { }, "ok" : 1 }
*https://serverfault.com/questions/424465/how-to-reset-mongodb-replica-set-settings/424714#424714
Mongoimport command used is:
mongoimport --host Cluster0-shard-0/cluster0-shard-00-00-1jypq.mongodb.net:27017,
cluster0-shard-00-01-1jypq.mongodb.net:27017,
cluster0-shard-00-02-1jypq.mongodb.net:27017 --ssl --username <username>
--password <password> --authenticationDatabase admin --db tutorial
--collection somedocs --type CSV --file retail.csv --headerline
The error message is as follows:
2019-05-10T13:22:32.509+0500 [........................] tutorial.somedocs 4.0 KB/42.4 MB (0.0%)
2019-05-10T13:22:32.860+0500 Failed: error connecting to db server: no reachable servers
2019-05-10T13:22:32.860+0500 imported 0 documents
At this point in time, i am really out of ideas, and i do not know how to proceed forward. Looking forward to your cooperation and valuable ideas in this regard.
Thanks,
I am new to mongoDB and i am trying to get it configured and running on my Ubuntu server. When i go and enter this command in my terminal
sudo service mongod start
I get the following output
start: Job is already running: mongod
So, when i try to enter the shell with
mongo
I get the following output
2015-02-24T14:54:39.557-0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-02-24T14:54:39.559-0800 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
I know I'm not working locally so I heard over to the mongod.conf file and change the following
port = 5000
# Listen to local interface only. Comment out to listen on all interfaces.
bind_ip = 10.0.1.51
Where bind_ip is now my ubuntu server and the port is 5000 as shown, so now i restart the service with
sudo service mongod restart
and outsputs
mongod start/running, process 1755
And now I try to renter back into shell with
mongo
and i still get the same error messages
MongoDB shell version: 2.6.7
connecting to: test
2015-02-24T15:01:26.229-0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-02-24T15:01:26.230-0800 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
Can someone help me out with this issue? I've been going through the forums and nothing appears to be working. Thanks.
If anyone is having trouble, i looked into mongod --help and found the following solutions
mongod --smallfiles
or
mongod --nojournal
hope this helps anyone.