Closed chstrong closed 9 years ago
Are you sure the username and password is testdb?
Yes. I've tried it on two Macs. My iMac and the MacBook Air both running on Mavericks. On both exactly the same issue.
Here the commands I run
brew install node sudo npm -g install sails sails new testProject cd testProject npm install sails-orientdb --save sails generate api person sails lift
On database side i add a user called testdb with password testdb and add the admin role. The database I've created is also called testdb.
Can you post the users section in the orientdb-server-config.xml file here?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <orient-server> <handlers> <handler class="com.orientechnologies.orient.graph.handler.OGraphServerHandler"> <parameters> <parameter value="true" name="enabled"/> <parameter value="50" name="graph.pool.max"/> </parameters> </handler> <handler class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin"> <parameters> <parameter value="${distributed}" name="enabled"/> <parameter value="${ORIENTDB_HOME}/config/default-distributed-db-config.json" name="configuration.db.default"/> <parameter value="${ORIENTDBHOME}/config/hazelcast.xml" name="configuration.hazelcast"/> </parameters> </handler> <handler class="com.orientechnologies.orient.server.handler.OJMXPlugin"> <parameters> <parameter value="false" name="enabled"/> <parameter value="true" name="profilerManaged"/> </parameters> </handler> <handler class="com.orientechnologies.orient.server.handler.OAutomaticBackup"> <parameters> <parameter value="false" name="enabled"/> <parameter value="4h" name="delay"/> <parameter value="backup" name="target.directory"/> <parameter value="${DBNAME}-${DATE:yyyyMMddHHmmss}.zip" name="target.fileName"/> <parameter value="9" name="compressionLevel"/> <parameter value="1048576" name="bufferSize"/> <parameter value="" name="db.include"/> <parameter value="" name="db.exclude"/> </parameters> </handler> <handler class="com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter"> <parameters> <parameter value="true" name="enabled"/> <parameter value="SQL" name="allowedLanguages"/> </parameters> </handler> <handler class="com.orientechnologies.orient.server.token.OrientTokenHandler"> <parameters> <parameter value="false" name="enabled"/> <parameter value="" name="oAuth2Key"/> <parameter value="60" name="sessionLength"/> <parameter value="HmacSHA256" name="encryptionAlgorithm"/> </parameters> </handler> </handlers> <network> <sockets> <socket implementation="com.orientechnologies.orient.server.network.OServerSSLSocketFactory" name="ssl"> <parameters> <parameter value="false" name="network.ssl.clientAuth"/> <parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/> <parameter value="password" name="network.ssl.keyStorePassword"/> <parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/> <parameter value="password" name="network.ssl.trustStorePassword"/> </parameters> </socket> <socket implementation="com.orientechnologies.orient.server.network.OServerSSLSocketFactory" name="https"> <parameters> <parameter value="false" name="network.ssl.clientAuth"/> <parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/> <parameter value="password" name="network.ssl.keyStorePassword"/> <parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/> <parameter value="password" name="network.ssl.trustStorePassword"/> </parameters> </socket> </sockets> <protocols> <protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/> <protocol implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb" name="http"/> </protocols> <listeners> <listener protocol="binary" socket="default" port-range="2424-2430" ip-address="0.0.0.0"/> <listener protocol="http" socket="default" port-range="2480-2490" ip-address="0.0.0.0"> <commands> <command implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent" pattern="GET|www GET|studio/ GET| GET|.htm GET|.html GET|.xml GET|.jpeg GET|.jpg GET|.png GET|.gif GET|.js GET|.css GET|.swf GET|.ico GET|.txt GET|.otf GET|.pjs GET|.svg GET|.json GET|.woff GET|.ttf GET|.svgz" stateful="false"> <parameters> <entry value="Cache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache" name="http.cache:.htm .html"/> <entry value="Cache-Control: max-age=120" name="http.cache:default"/> </parameters> </command> <command implementation="com.orientechnologies.orient.graph.server.command.OServerCommandGetGephi" pattern="GET|gephi/_" stateful="false"/> </commands> <parameters> <parameter value="utf-8" name="network.http.charset"/> </parameters> </listener> </listeners> </network> <storages/> <users> <user resources="*" password="mypass" name="root"/> <user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/> </users> <properties> <entry value="1" name="db.pool.min"/> <entry value="50" name="db.pool.max"/> <entry value="true" name="profiler.enabled"/> <entry value="info" name="log.console.level"/> <entry value="fine" name="log.file.level"/> </properties> </orient-server>
You have to use the username and password set up in the server-config file. As an example I would use user:root and password:admin
<users>
<user resources="*" password="admin" name="root"/>
<user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/>
</users>
Ok, but this would mean that I always need to manually add users to the users section? I thought I can add users over the web interface without having to manually add them. Or am I wrong here?
I got following feedback from OrientDb:
Hi Christopher,
Since v0.10.53 (PR #86) sails-orientdb allows to authenticate against OrientDB using DB credentials only. This requires the DB to already be created, though.
Cheers,
I have the newest version as I used: npm install appscot/sails-orientdb
Which is 0.10.55. So this means that it should work without adding the user to the server-config file.
This is also stated here: https://github.com/appscot/sails-orientdb/releases
Hi @chstrong, that was me and I'm not from OrientDB, I'm one of the sails-orientdb developers. :)
The way to connect to a DB without server credentials is by using options.databaseUser
and options.databasePassword
, for example:
myLocalOrient: {
adapter: 'sails-orientdb',
host: 'localhost',
port: 2424,
database: 'testdb',
options: {
databaseUser: 'testdb',
databasePassword: 'testdb'
}
}
By not including user
and password
, sails-orientdb will skip server authentication meaning it won't be able to perform server operations such as creating a DB, for example.
First of all in the configuration section in the description you write that the adapter name is called "orient". I however can only connect to it if I use "sails-orientdb" as adapter name.
I'm guessing you missed the part in configuration that says:
Sails-orientdb can be used with SailsJS, for more information on how to use Waterline in your Sails App view the Sails Docs. An example configuration for SailsJS is provided here.
The config you are quoting is for waterline used standalone and is preceded with:
var orientAdapter = require('sails-orientdb');
var config = {
adapters: {
'default': orientAdapter,
orient: orientAdapter,
},
//...
Hi dmarcelino,
Ok :) Sorry for my confusion. It is working now. It's a little difficult to find the right information on the OrientDb page and I'm not familiar with all the paradigms yet. Hopefully soon.
Thanks a lot for your help with this.
No problem :wink:
Hi,
Could it be that the adapter is not working correctly? I have following versions:
First of all in the configuration section in the description you write that the adapter name is called "orient". I however can only connect to it if I use "sails-orientdb" as adapter name.
I have following configuration:
myLocalOrient: { adapter: 'sails-orientdb', host: 'localhost', port: 2424, user: 'testdb', password: 'testdb', database: 'testdb' }
Through the orientdb console the connection is working fine.
When I run "sails lift" I however get following error:
error: A hook ( (_streamreadable.js:710:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable (_stream_readable.js:382:10)
at emitReadable (_stream_readable.js:378:5)
at readableAddChunk (_stream_readable.js:143:7)
at Socket.Readable.push (_stream_readable.js:113:10)
at TCP.onread (net.js:511:21)
From previous event:
at Connection._sendOp (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/connection.js:81:10)
at process._tickDomainCallback (node.js:459:13)
From previous event:
at Connection.send (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/connection.js:68:27)
at BinaryTransport.connect (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/index.js:160:52)
at BinaryTransport.send (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/index.js:194:17)
at Server.send (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/server/index.js:112:25)
at Server.list (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/server/index.js:248:15)
at Connection._ensureDB (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/lib/connection.js:604:22)
at ensureDbAndListClasses (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/lib/connection.js:495:10)
at /Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:709:13
at /Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:227:13
at /Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:106:13
at _arrayEach (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:78:13)
at _forEachOf (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:105:9)
at _each (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:70:13)
at async.forEachOf.async.eachOf (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:226:9)
at _parallel (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:708:9)
at Object.async.parallel (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/async/lib/async.js:723:9)
at Connection._init (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/lib/connection.js:513:9)
at new Connection (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/lib/connection.js:66:8)
at Object.module.exports.adapter.registerConnection (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/lib/adapter.js:171:42)
at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline.js:203:29
at /usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:162:20
at /usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:230:13
at _arrayEach (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:81:9)
at _each (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:72:13)
at Object.async.forEachOf.async.eachOf (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:229:9)
orm
) failed to load! error: OrientDB.RequestError: Wrong user/password to [connect] to the remote OrientDB Server instance. Get the user/password from the config/orientdb-server-config.xml file at Operation.parseError (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/protocol28/operation.js:879:13) at Operation.consume (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/protocol28/operation.js:469:35) at Connection.process (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/connection.js:380:17) at Connection.handleSocketData (/Users/charms/Documents/Temp/testProject/node_modules/sails-orientdb/node_modules/oriento/lib/transport/binary/connection.js:281:17) at Socket.EventEmitter.emit (events.js:95:17) at Socket.