Thursday, August 10, 2017

Re: [google-cloud-sql-discuss] Google Compute Engine VM connection to Google SQL Instance

Other debugging that might be helpful:
- check mysql log (via stackdriver logging) for errors
- enable mysql general_log (see https://cloud.google.com/sql/docs/mysql/flags#tips-general-log) to investigate what sql is actually running on your instance

On Thu, Aug 10, 2017 at 2:44 PM, JinGuru <jinguruxxx@gmail.com> wrote:
Hi David

Thanks for the response. As not the originator of the script, i will have to refer to my original developer with your thoughts and go from there.

In the meantime i have discovered that the same setup but this time connecting to a 1st Generation Google Cloud SQL works perfectly fine...

On 9 August 2017 at 06:46, 'David Newgas' via Google Cloud SQL discuss <google-cloud-sql-discuss@googlegroups.com> wrote:
Hi,

Do I understand that you can connect to the database and run INSERT statements without error, but then later the new data isn't there?

It's possible that you are in a transaction but never committed it, either because something ran START TRANSACTION or set autocommit=0 statements. If this is the case, either don't do those, or make sure to COMMIT at the end of the transaction.
It's also possible you have an in memory table. try using SHOW CREATE TABLE table_name, and make sure that it gives storage engine InnoDB (this is the only storage engine you should be using on Cloud SQL).

There are probably a lot of other possibilities, but I'm not sure I'm gonna be able to find them for you without more details on the issue and your architecture.

On Thu, Aug 3, 2017 at 4:36 PM, jinguruxxx <jinguruxxx@gmail.com> wrote:
Hi David

I followed through with your instructions and followed the link 

I successfully was able to connect my GCE instance with my 2nd Generation SQL instance.

However - the solution as it stands is not quite complete. Hopefully my description will shed some light for you guys to provide an solution

I am running a php-based script on the GCE
Have a LAMP stack installed, with a local database 
The script allows for users to upload profile pictures and audio (mp3) clips (audio goes to an Amazon S3 bucket)
This set up runs perfectly fine with the local database.

I then try to connect to a 2nd generation SQL database (which has the same database logs as the local one)
my config.php file with MySQL credentials are updated for this and the IP address of the GCE instance is white-listed
MySQL connection is confirmed
however (and this is the bit i am a bit confused about)...

my site now has about 60% functionality. 
- new registers can't register (ie their details are not written to the Google SQL database)
- existing users cannot upload , or perform other peripheral functions.

I know the script is not the problem, so i can only conclude that either

- i have missed a key configuration which is hampering the functionality of the script
- or i have to fundamentally get someone to reorganise the architecture to accomodate for the Google Cloud SQL (un/likely?)

Any thoughts/advice/assistance would be greatly appreciated

Thanks






On Tuesday, 25 July 2017 17:11:22 UTC+1, David Newgas wrote:
Hi,

As I mentioned in my other email, those instructions are for Google App Engine. On Google Compute Engine, you have two options:
  1. Connect to the public IP address of your Cloud SQL instance. This requires you whitelist your GCE instance on the ACL for the Cloud SQL instance.
  2. Use the Cloud SQL proxy. This is a extra daemon you run on your GCE instance that allows you to connect via TCP on localhost or a socket.
Complete instructions for both of these options are available at https://cloud.google.com/sql/docs/mysql/connect-compute-engine.

On Mon, Jul 24, 2017 at 7:28 PM, jinguruxxx <jingu...@gmail.com> wrote:
Hi
I seem to have a problem configuring a config.php which basically connects my website on the VM to an SQL database on Google SQL

I also have phpMyAdmin successfully installed and can access it via <VM_IPAddress>/phpMyAdmin

In turn, i have also successfully configured phpMyAdmin so that i can log in to the localhost database and the my Google SQL database.
This part of the process i have performed successfully for both First Generation and Second Generation instances

The part which is causing me headache is the seemingly simple addition of credentials to the config.php on my Google VM instance which needs to point to the relevant database.,

I'm sure you are familiar with this format:


// The MySQL credentials
$CONF['host'] = 'localhost';
$CONF['user'] = 'user';
$CONF['pass'] = 'password';
$CONF['name'] = 'database name';


$CONF['host'] = 'localhost'; is the part that is giving me a problem - i am normally used to just having it as localhost or pointing to a specific IP address
inputting the ip adress eg  34.125.258 of the database instance does not seem to work


seems to indicate 

$CONF['host'] = ':/cloudsql/project-id:region:sql-db-instance-name';
which for sake of example:
$CONF['host'] = ':/cloudsql/live-001:europe-west1:totaldata';

but this yields same result

Have i missed something?

Please assist! Getting quite frustrated by the process here and any help would be much appreciated!

Thanks in advance





--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/6de8b295-89aa-4868-9a67-10b1f8c3c2dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/6222e044-142e-4d7a-8e98-52117a461986%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-cloud-sql-discuss/WVcBgfnLEuY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/CAJZK_bYPgiEpZct%2BSne6LR1WPr-NVLqsEuTjJ-axrCVODiSD7w%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/CADLGrHbJOpftNuVSTwhK-0OB-t6YK7Rm693k_1rKNYghxf5iyw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/CAJZK_barJNd_Sxnf2bMxWmfinqBj9mrf6gHkKPNUSJLp7TKpFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment