I'm looking at Google app engine for deploying my Java web app which connects to a mongodb database through the mongodb java driver.
Plan 1:
Deploy MongoDb Database in Google Compute Engine
Deploy Java Web app in Google App Engine and pass the address of the MongoDb (in GCE) to the mongodb driver
Plan 2:
Deploy both Mongodb and Java web app in Google Compute engines
Question 1: Will Plan 1 work ?
Question 2: I think Plan 2 will probably work. But is it the most efficient method ? If not, can you suggest a more efficient method?
Note: Im on planning on using Google Datastore.
Your plan 1 is feacible, the only thing you need to ensure is that your App Engine and Compute Engine (MongoDB) are in the same virtual network. As it is stated here.
The plan 2 won't be cost effective due to the requirement of having the intance(s) running your app on 24x7. Even if there are no traffic you will have to pay for them. Google App Engine will give you the chance of having a free quota.
Related
As a part of my thesis project, I have been given a MongoDB dump of size 240GB which is on my external hard drive. I'll have to use this data to run my python scripts for a short duration. However, since my dataset is huge and I cannot mongoimport on my local mongodb server (since I don't have enough internal memory), my professor gave me a $100 google cloud platform coupon so I can use the google cloud computing resources.
So far I have researched that I can do it this way:
Create a compute engine in GCP and install mongodb on remote engine. Transfer the MongoDB dump to remote instance and run the scripts to get the output.
This method works well but I'm looking for a method to create a remote database server in GCP so I that I can run my scripts locally, which is something like one of the following.
Creating a remote mongodb server on GCP so that I can establish a remote mongo connection to run my scripts locally.
Transferring the mongodb dump to google's datastore so then I can use the datastore API to remotely connect and run my scripts locally.
I have given a thought of using MongoDB atlas but because of the size of the data, I will be billed hugely and I cannot use my GCP coupon.
Any help or suggestions on how of either of the two methods can be implemented is appreciated.
There is 2 parts to your question
First, you can create a compute engine VM with MongoDB installed and load your backup on it. Then, open the right firewall rules for allowing the connexion from your local environment to the Google Compute Engine VM. The connexion will be performed with a simple login/password.
You can use a static IP on your VM. By the way, in case of reboot on the VM you will keep the same IP (and it will be easier for your local connexion).
Second, BE CAREFUL to datastore. It's a good product, serverless NoSQL database, document oriented, but it's absolutely not the MongoDB equivalent. You can't perform aggregate, you are limited in search capabilities,... It's designed for specific use case (I don't know yours, but don't think that is the MongoDB equivalent!).
Anyway, if you use Datastore, you will have to use a service account or to install Google Cloud SDK on your local environment to be authenticated and to be able to request Datastore API. No login/password in this case.
I have an ASP.NET application running IBM Cloud, and I have a MongoDB instance created, and my application is deployed in my development-space, and bound to the MongoDB(alias). All working fine.
Now, I have also created a production-space, and want to deploy the application there, after having verified it in Dev.
But - do I really have to create another MongoDB - and pay for 2 instances, or can I somehow share one instance (with security seperating that dev cant access prod)?
Or what is best practice in this case?
Any advice much appreciated.
It is your call. The connection string to the mongodb will work from both dev and prod. I would recommend having two mongodb instances. A separate dev mongodb will allow development to work in isolation both functionally, performance and security.
I would like to know the plan of "DataCache" service before creating an instance from marketplace.
I can see there is a "DataCache" service in marketplace:
C:\Users\IBM_ADMIN>cf marketplace | findstr Data
- DataCache free, starter*, standard*, premium*
Improve the performance and user experience of web applications by retrieving information from fast, managed, in-memory caches, instead of relying entirely on slower disk-based databases.
- DataWorks free
Find, prepare, and deliver data with an intuitive app or with powerful APIs.
- MobileData Shared*
Enhance your mobile apps through simple to use SDKs to save shared data in a scalable, managed database as a service. Powered by Cloudant.
- XPagesData xpages-data-free
Create an IBM Notes .NSF database to store your XPages Domino data.
- namara-catalog free
Open Data. Clean and simple.
- reappt reappt:pushtechnology:dif03
Real Time Data Distribution Service
- sqldb sqldb_small*, sqldb_free, sqldb_premium*
SQL Database adds an on-demand relational database to your application. Powered by DB2, it provides a managed database service to handle web and transactional workloads.
- timeseriesdatabase small*
Time Series Database (powered by Informix) is purpose-built for fast and efficient storage and analysis of time series data.
When I try to retrieve detail description of the "DataCache" service, I got the "Could find service" error.
C:\Users\IBM_ADMIN>cf marketplace -s "DataCache"
Getting service plan information for service DataCache as yujames.tw#gmail.com...
FAILED
Could not find service
However, I can retrieve detail description for any other service such as "DataWorks":
C:\Users\IBM_ADMIN>cf marketplace -s "DataWorks"
Getting service plan information for service DataWorks as yujames.tw#gmail.com...
OK
service plan description free or paid
free There is currently no charge for the use of this service. free
Any idea?
cf m | grep DataCache
DataCache free, starter*, standard*, premium*
The plans are free, starter, standard and premium. I agree that getting details for some services does not work using cf - defect. I will raise this issue with the team.
See plans in the UI
To create it
cf cs DataCache free myDataCache
There are articles both here and over at OpenShift itself that suggest I can configure an app with a MongoDB and then set envvars within other apps to access that DB
e.g.
How do you access a MongoDB database from two Openshift apps?
and
https://blog.openshift.com/sharing-database-across-applications/
Problem is that the envvars/hostname for the app DB is either "localhost" or a dotted-quad (129.xxx.xxx.xxx) which clearly won't (and actually doesn't - I tried it) work if used in a connection-string from another app (in the same OpenShift 'domain'
Is this something OpenShift have done to discourage this sort of usage? at least on the 'free' tier?? - or am I missing something/has anyone got this working atm???
p.s. using the actual connection string for the app (e.g. app-domain.rhcloud.com) doesn't work (even from an 'internally hosted' app)
You need to create the application as scalable, then add MongoDB for it to work correctly. MongoDB will then go onto it's own gear, with it's own ip address and port number (remember to use this port number, or nothing will work).
You will never be able to access your mongodb gear from outside of openshift without using the rhc port-forward command (https://developers.openshift.com/en/managing-port-forwarding.html) because of firewall & other security issues.
However, if you use the scaled application approach, you will be able to connect to your mongodb instance from other openshift online hosted applications.
Can we use Google Cloud SQL off Google App Engine ?
I'm also looking for examples of its use.
Yes, but you have to use the custom JDBC driver.
https://developers.google.com/cloud-sql/docs/external
You should expect high latency since your client will not be colocated with the mysqld.
You can also use the JDBC driver for admin tools:
https://developers.google.com/cloud-sql/docs/admin_tools