Unable to connect to mongo (3.4) using robomongo (0.9.0) and username and password? - windows

I have a mongo 3.4 instance with a cfg file thus:
systemLog:
destination: file
path: D:\Mongo\log\mongod.log
storage:
dbPath: D:\Mongo\db
Using robomongo version 0.9.0 I've added a user:
Now when I try and connect to the DB I get an error:
I've checked passwords etc all seems correct:
Without using auth all works as expected.
I've ran though a similar issue Mongodb & Robomongo: Can't connect (authentication) but because I have a newer version of the client (0.9) which supports SCRAM-SHA-1 this should work.
What am I missing here?

Looks like there's a bug in robobmongo. If I add the user using the console:
db.createUser({user:"mongoUser", pwd:"***", roles:["userAdminAnyDatabase"]})
Authentication works. But I now get an error from robomongo:
when I try and expand the list of users in admin.

Related

Laravel 5.7 mongodb atlas connection problem using jenssegers/mongodb

I want to connect my laravel 5.7 application(I used the 3.4 version of jenssegers/mongodb) with a mongodb in atlas, I tried in localhost(I isntalled the mongo extension) and everything is ok but with atlas i got an error message:
Failed to parse MongoDB URI:
'mongodb://root%3Acluster0.xxx.mongodb.net%3A27017%2Fhddatabase%3FretryWrites%3Dtrue%26w%3Dmajority'.
Invalid host string in URI.
My env file:
DB_CONNECTION=mongodb
DB_DSN="mongodb://root:password#cluster0.xxx.mongodb.net:27017/hddatabase?retryWrites=true&w=majority"
DB_DATABASE=hddatabase
My database config:
'mongodb' => [
'driver' => 'mongodb',
'dsn' => env('DB_DSN'),
'database' => env('DB_DATABASE'),
],
TL;DR: The url is wrong. "+srv" part is missing.
Please copy the url from the Atlas Connection Wizard:
You can open the connection from the Cluster View:
Details
Atlas provides a replica set cluster of 3 mongo db instances by default. Your local database is standalone.
There are 2 formats to connect to mongodb:
mongodb:// is the legacy one that requires all members of the replica set to be explicitly present in the url. E.g.: mongodb://<username>:<password>#cluster0-shard-00-00.xxx.mongodb.net:27017,cluster0-shard-00-01.xxx.mongodb.net:27017,cluster0-shard-00-02.xxx.mongodb.net:27017/<dbname>?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority
mongodb+srv:// is the "srv" format which lets the driver to retrieve replica set configuration from mongodb itself, so the url is much simpler: mongodb+srv://<username>:<password>#cluster0.xxx.mongodb.net/<dbname>?retryWrites=true&w=majority
You are using the later format and the legacy schema so the driver complains.
As a side note it is advisable to use configuration options username and password as documented in https://github.com/jenssegers/laravel-mongodb#configuration rather than pass them in the url. URL format requires special characters like #, /, etc in the password to be escaped, which unnecessarily complicates credentials management.
Try with this DNS maybe :
mongodb://root:password#cluster0.xxx.mongodb.net:27017
Even with the 'srv' format I'm getting the same error, The problem is that I'm using the version 3.4.0 of jenssegers/mongodb, I upgraded to version 3.4.6 and used the 'srv' format and problem is solved now !

Phoenix-framework : Mysql connection error on production

I am new to Phoenix and actually working on my first project in it.
When deploying the project on production server, I am getting a Database Connection error for mySql. For some reason, it is not considering the username/password values provided in config/prod.exs
import Config
config :g_plus, GPlusWeb.Repo,
username: "root",
password: "Somepassword",
database: "db_name",
hostname: "localhost",
load_from_system_env: true,
pool_size: 20
I also tried with environment variable (DATABSE_URL), but it is still not working.
ecto://root:Somepassword#localhost:3306/db_name
Am I missing any setting/config somewhere?
I couldn't find anything in Google search as well.
Most deployment guides are for apps without DB.
I found the issue. I was using GPlusWeb instead of just GPlus in the following line.
config :g_plus, GPlusWeb.Repo,
I changed it to config :g_plus, GPlus.Repo, and it worked.

Can't create bucket using aws-sdk ruby gem. Aws::S3::Errors::SignatureDoesNotMatch

I have a new computer and I'm trying to set up my AWS CLI environment so that I can run a management console I've created.
This is the code I'm running:
def create_bucket(bucket_args)
AWS_S3 = Aws::S3::Client.new(signature_version: 'v4')
AWS_S3.create_bucket(bucket_args)
end
Which raises this error:
Aws::S3::Errors::SignatureDoesNotMatch - The request signature we calculated does not match the signature you provided. Check your key and signing method.:
This was working properly on my other computer, which I no longer have access to. I remember debugging this same error on the other computer, and I thought I had resolved it by adding signature_version = s3v4 to my ~/.aws/config file. But this fix is not working on my new computer, and I'm not sure why.
To give some more context: I am using aws-sdk (2.5.5) and these aws cli specs: aws-cli/1.11.2 Python/2.7.12 Linux/4.4.0-38-generic botocore/1.4.60
In this case the issue was that my aws credentials (in ~/.aws/credentials) - specifically my secret token - were invalid.
The original had a slash in it:
xx/xxxxxxxxxxxxxxxxxxxxxxxxxx
which I didn't notice at first, so when I double clicked the token to select the word, it didn't include the first three characters. I then pasted this into the terminal when running aws configure.
To fix this, I found the correct, original secret acceess token and set the correct value in ~/.aws/credentials.

why am I getting an empty test suite with parallel_tests ruby gem

Any help getting the gem working would be appreciated. I'm down to configuration issues (i think) and there isn't a lot of documentation to help me get running.
So I have the parallel_tests gem in my project. I believe I have two problems, one that cannot be seen without the other.
The first problem is that I don't think I have my database.yml file setup correctly. #1 we call it servers.yml (not sure if there is an importance with the name), and 2 we didn't have a "test" section setup. The example shows
test:
database: yourproject_test<%= ENV['TEST_ENV_NUMBER'] %>
our server.yml file contains the following:
db1:
adapter: jdbc
driver: oracle.jdbc.driver.OracleDriver
url: url_to_db1
username: uname
password: pass
db2:
adapter: jdbc
driver: oracle.jdbc.driver.OracleDriver
url: url_to_db2
username: uname
password: pass
db3:
adapter: jdbc
driver: oracle.jdbc.driver.OracleDriver
url: url_to_db3
username: uname
password: pass
so I just added the test line above the rest of the databases at the top of the file
The problem is I cannot even check to see if that's working right because when I try to run the parallel_tests gems, it returns empty!!!!
This is the guide I've been following, with the exception of finding out I had to require parallel_tests/tasks into my rakefile: https://github.com/grosser/parallel_tests
I have require 'parallel_tests/tasks' in my rakefile
I run the 3 commands in the parallel_tests gem to get execution running (don't worry about the java options and java tool options)
As you can see, there are no error messages, nothing out of the ordenary other then my tests do not run with or without the parameters to the features task. The following is a printout of the trace stack
Was running this on a windows machine... Windows doesn't support forking which is what this gem does.
Update, the newer versions of the gem allow you to run on any platform, with a new command. parallel_cucumber is the new command. Check https://github.com/grosser/parallel_tests for more details

Node.js, Session with infinite loop

I'm using expressjs and connect-mongo#0.1.7 as the MongoStore for session.
What happen is, the session code was working. but after I upgrade node and npm to the latest version, and Mongo to 2.0.2, then if I put express.session ( store:new MongoStore) then it will run a infinite loop. Any idea what's happening?
here is my code:
express.createServer(
express.cookieParser(),
express.bodyParser(),
express.session({ secret: cfg.session_secret,
cookie: { domain: 'mydomain.com' },
store:new MongoStore({
db: cfg.db_session_name,
host: cfg.db_ip,
port: cfg.db_port
})
})
)
Here is the error:
TypeError: Not a string or buffer
at Object.createHmac (crypto.js:129:21)
at Object.sign (/node_modules/connect-mongo/node_modules/connect/lib/utils.js:135:6)
at Object.serialize (/node_modules/connect-mongo/node_modules/connect/lib/middleware/session/cookie.js:115:17)
at ServerResponse.writeHead (/node_modules/express/node_modules/connect/lib/middleware/session.js:265:46)
at ServerResponse._implicitHeader (http.js:808:8)
at ServerResponse.end (http.js:645:10)
at next (/node_modules/express/node_modules/connect/lib/http.js:167:13)
at pass (/node_modules/express/lib/router/index.js:219:24)
at nextRoute (/node_modules/express/lib/router/index.js:209:7)
at callbacks (/node_modules/express/lib/router/index.js:274:11)
Just got the temp solution for that. from another noder "jacobstr"
see this: https://github.com/kcbanner/connect-mongo/issues/29#issuecomment-4233108
So, I go to node_modules/connect-mongo folder. Edit the package.json like that: https://github.com/jacobstr/connect-mongo/blob/master/package.json (only one change: <2 ).
Then in that folder, run sudo npm install -d
then everything works. :)
I ran into the same issue. I believe this is being caused by express and connect-mongo using different versions of connect and those different versions have different method signatures for the cookieParser. The version connect-mongo is using expects to be passed a "secret" key for signing the session data, but the version express uses does not supply it.
There is an update to express on GitHub to support connect 2.0, but it is not available via npm yet.

Resources