Heroku Mongo Url (Copying db from heroku) - ruby

I'm trying to write a script that copys my heroku db to my local db (mongodb), but I dont have a clue what kind of url format this is:
mongodb://<username>:<password>#lamppost.5.mongolayer.com:10049,lamppost.4.mongolayer.com:10049/<appname>
Why are there two urls, comma separated?
Does anyone have a working script to share? :)

The format is a MongoDB Connection String URI for a replica set.
The two hosts listed are members of the replica set provided as a "seed list" for connecting to your MongoHQ instance. Specifying more than one member of the replica set allows for failover -- the MongoDB driver will attempt to connect to the first available member of the seed list in order to discover the current configuration of a replica set.
You can use this URI to connect from Ruby via MongoClient.from_uri(uri).

Related

How to list all Websphere installed applications for a given Middleware server using jython

I have a Websphere 8.5.5.12 installation with multiple applications running on it. For a given Middleware Server, I'd like to be able to list all applications associated with it using Jython.
I have gone as far as writing this code:
wsadmin>print AdminApp.list("WebSphere:cell=myCell,node=myNode")
However this is retrieving applications for a different Dynamic Cluster
If I add a specific server, it errors out
wsadmin>print AdminApp.list("WebSphere:cell=myCell,server=myServer")
ADMA0184E: myServer is not a valid target.
Your query should look like:
wsadmin>AdminApp.list("WebSphere:cell=myCell,node=myNode,server=server1")
It appears you're missing the node identifier in your query. And if wsadmin still returns "myServer is not a valid target", then the server name is wrong, try looking at your app server profile directory structure to double check it.

RethinkDB does not create help and help_internal databases

I am trying to use the Horizon framework by the RethinkDB team but I am facing startup issues with Rethink. I try to start up the server with the command
rethinkdb --http-port 8082
all works fine but when I run my app.js where horizon is embedded, I obtain the error.
error: Connection to RethinkDB terminated: Error: The database help_internal does not exist.Run hz set-schema to initialize the database, then start the Horizon server.
I ran the command above and it creates a rethinkdb_data folder and whenever I restart the server, it gives me the same error.
You need to tell hz set-schema how to connect to the RethinkDb server you're running, otherwise it will create its own in your current working directory. You can pass it the same connection options you pass to hz serve.
I also got this error. It can be confusing because in dev mode of horizon it usually creates these databases for you.
In prod, however, you must create the databases yourself. To do this it is as simple as logging into RethinkDB's admin interface, click on the "Tables" navigation item then clicking the "+ Add Database" button. Create two databases called 'help' and 'help_internal' assuming that your horizon project_name name is 'help'.
Note that in addition to creating the databases I've described you may also need to create tables in these databases. This is where you should use get-schema on your dev server (to dump the current schema to disk) and set-schema on your prod server (to create the tables needed to support the schema).
For some npm tasks that accomplish the getting and setting of schema you can see here.

Mule Connect to remote flat files

I am new to Mule and I have been struggling with a simple issue for a while now. I am trying to connect to flat files (.MDB, .DBF) located on a remote desktop through my Mule application using the generic database connector of Mule. I have tried different things here:
I am using StelsDBF and StelsMDB drivers for the JDBC connectivity. I tried connecting directly using jdbc URL - jdbc:jstels:mdb:host/path
I have also tried to access through FTP by using FileZilla server on remote desktop and using jdbc URL in my app - jdbc:jstels:dbf:ftp://user:password#host:21/path
None of these seem to be working as I am always getting Connection exceptions. If anyone has tried this before, what is the best way to go about it? Connecting a remote flat file with Mule? Your response on this will be greatly appreciated!
If you want to load the contents of the file inside a Mule flow you should use the file or FTP connector, i don't know for sure about your JDBC option.
With the File connector you can access local files (files on the server where mule is running), you could try to mount the folders as a share.
Or run an FTP server like you already tried, that should work.
There is probably an error in your syntax / connection.
Please paste the complete XML of your Mule flow so we can see what you are trying to do.
Your usecase is still not really clear to me, are you really planning to use http to trigger the DB everytime? Anyway did you try putting the file on a local path and use that path in your database url. Here is someone that says he had it working, he created a separate bean.
http://forums.mulesoft.com/questions/6422/setting_property_dynamically_on_jdbcdatasource.html
I think a local path is maybe possible and it's better to test that first.
Also take note of how to refer to a file path, look at the examples for the file connector: https://docs.mulesoft.com/mule-user-guide/v/3.7/file-transport-reference#namespace-and-syntax
If you manage to get it working and you can use the path directly in the JDBC url, you should have a look at the poll scope.
https://docs.mulesoft.com/mule-user-guide/v/3.7/poll-reference
You can use your DB connector as an inbound endpoint when wrapped in a poll scope.
I experienced the same issue when connect to Microsoft Access Database (*.mdb, *.accdb) using Mule Database Connector. After further investigation, it's solved by installing Microsoft Access Database Engine
Another issue, I couldn't pass parameter to construct a query as same as I do for other databases. e.g.: SELECT * FROM emplcopy WHERE id = #[payload.id]
To solve this issue:
I changed the Query type from Parameterized into Dynamic.
I generated the query inside Set Payload transformer (generate the query in form of String, e.g.: SELECT * FROM emplcopy WHERE id = '1').
Finally, put it into the Dynamic query area: #[payload]

C# mongod- insert fails with "unable to connect to server, attempted to read past the stream"

I am able to create a successful connection to a remote mongodb server and database. When I try and insert the document into a collection I get the following error:
Unable to connect to server xxx.xxx.x.xx:28017: Attempted to read past the end of the stream..
after a little lag. I am not sure what the issue is if the connection seems fine.
server = New MongoClient("mongodb://admin:password#xxx.xxx.x.xx:28017/").GetServer
db = server.GetDatabase("TestDB")
mongoC = db("TestCpo")
Have you made sure that Mongo is up and running? Open up a command line, navigate to the location of your mongo installation then to the bin directory, type in "mongod". This will start up the mongo server, you need to have the mongo server up and running before you can do anything with it.
It's also useful to add the path to your environment variables so that it can be set up easier.
Another thing you could do is use
Process.Start(#"C:\[Directory of the mongo installation]\bin\mongod.exe");
(this is probably more useful if you want to start Mongo under test conditions)

How to use DATABSE_URL in Play 2.0 (Scala) for local connection to PostgreSQL 9.1 & Heroku?

I have developed a first web application using a local PostgreSQL 9.1 on OSX (Lion 10.7.4) using Play! Framework 2.0.3. I started with my database connection defined in conf/application.conf (relative to application's directory) with
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost/fotoplay"
db.default.user=foo
db.default.password=bar
(username and password have been changed before posting) This works for writing and testing. I now want to deploy to Heroku. I have set up the Procfile (in application's directory) with a single line:
web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS}
-DapplyEvolutions.default=false
-Ddb.default.driver=org.postgresql.Driver
-Ddb.default.url=$DATABASE_URL
I have exported DATABASE_URL in .bash_profile so that I can echo $DATABASE_URL at the system command line and get
postgres://foo:bar#localhost/photoplay
At Heroku, I have set up an instance of postgresql. I'm not sure on how to write a database evolution to populate heroku, so I turned that off evolutions and populated my database manually. My current evolutions build tables and populate them with some initial data from some csv files, so I would need to place the csv files somewhere accessible to heroku. At least for a first pass, I don't want to tackle this issue just yet. But as a result of the manual steps, I have a populated database on Heroku.
With this configuration, my application runs correctly locally. However, I am not using DATABASE_URL, which seems wrong. I pushed this to HEROKU and is is not able to connect to the database. The error is:
Caused by: org.postgresql.util.PSQLException:
FATAL: password authentication failed for user "foo"
If I remove the username & password, I break my local configuration. I should be able to use DATABASE_URL 'instead of' the older syntax, but I don't quite know how to do that. I don't think that I can figure this out experimentally (wandering high dimensional spaces is hopeless, and there are several possible configuration settings that might be involved & are subject to typos). Any guidance on how I should set up application.conf would be appreciated.
Worth a try: in your application.conf file, change your db.default.url parameter in order to include the username & password in the URL, and remove the db.default.user and db.default.password parameters:
db.default.url="postgres://foo:bar#localhost/fotoplay"

Resources