Im setting a VM.
Both host and VM machine have Mysql.
How do keep the VM Mysql sync'd to to the host Mysql.
Host is using MYsql 5.5 on XP.
VM is Mysql 5.1 on Fedora 14.
1) I could DUMP to "shared," Restore. Not sure if this will work.
2) I could network Mysql Host to Mysql VM. Not how to do this
How would I do this with python 2.7?
I dont want them in sync after set-up phase. But, maybe sync some tables or SP occasionly on-rewrites. After I build out Linux Env. I would like to be able to convert V2P and have a dual-boot system.
You can use mysqldump to make snapshots of the database, and to restore it to known states after tests.
But instead or going into the complication of synchronizing different database instances, it would be best to open the host machine's instance to local network access, and have the applications in the virtual machine access that as if it was a remote server. Overall performance should improve too.
Even if you decide to run different databases for the host and the guest, run then both on the host's MySQL instance. Performance will be better, configuration management will be easier, and the apps in the guest will be tested against a realistic deployment environment.
Why are you using Python? Just use the built in replication abilities: http://dev.mysql.com/doc/refman/5.5/en/replication.html
Do you want it synced in realtime?
Why not just connect the guest's mysql process to the host?
Related
Connection problem solved! Leaving for others who may have issue.
Still having problems with bind-address issues
I will state the problem, the loayout context of my system and things I have tried.
Problem: When trying to use mysql connector in a python file i keep getting access denied. I am using Pycharm as my IDE and I have the Mysql connector installed though that.
So I am running Ubuntu Server on a Orale VM on a Windows 10 desktop, it's a bridged connection and I can SSH in from my laptop (LInux Mint)to the server just fine. I am running the program trying to access the DB on the Linux Mint laptop. Local network only using 192.168.0.xxx protocols. All VPN's disabled at this point for now.
So just to state i reinstalled the server last night and I set up fresh users and DB for the user and even granted ALL PRIVILEGES to the user and connections from my connectiong machines.
i set bind address in my mysqld.cnf file to 0.0.0.0 for now.
(when i had it set to my laptop ip it wouldn't bind and would restart until I switched it back)
UFW is set to allow mysql(3306)
Ask all the questions and I will get you answers asap. Please provide commands for me to run if needed and specify if the should be ran on the server or my laptop. Thanks for reading!
I have written a python script that uses the MySQL Connector for Python to read, write and update the database. Do I need to install MySQL server on the client machine (Windows) too to run the program or do I just need to make sure that the database is present in the path used by the script? I tried finding guidance on Google and here but couldn't find what I needed.
No you don't need to install MySQL Server on a client machine. By definition client machine means you don't have the DB/Server there. Where is this DB allocated? You show have an IP or a domain/subdomain address where the DB is actually hosted.
I am on mac with homebrew mysql, making a django app. I also use jupyter. I don't know which of these things is the root cause of the issue.
I used to get this error message coming up every now and again, and I know how to fix it: just type brew services restart mysql and wait a bit.
The problem is that it's now happening with increasing frequency, several times an hour. Is there a known fix for this, when working on a local machine?
I thought, since I'm ctrl-c ing programs frequently, that might be exhausting the connection pool so I increased the connection pool size using SET GLOBAL max_connections = 5000;, but that has not helped.
Just a suggestion - I would give Docker a shot (since you keep getting these interruptions).
Create a new container which will run your MySQL server exposing a port to the DB server then connect to that from your mac.
Here's a good resource to get you started - https://docs.docker.com/samples/library/mysql/#-via-docker-stack-deploy-or-docker-compose
Alternatively, if you don't have to use MySQL you could try using PostgreSQL. Here's a good article for that one - https://medium.com/agatha-codes/painless-postgresql-django-d4f03364989 . Many django projects are using that in production as it has a lot more features to offer.
I have a compute engine instance running on Google cloud platform.
I would like to use the Python interpreter of the compute engine as a remote interpreter with Pycharm. This means that I would be using Pycharm on my local machine and running computations remotely.
Any clue on how to achieve this?
The following requires, as James Hirschhorn pointed out, the Professional verison of PyCharm.
Assign a public IP to the remote machine on GCP.
Run gcloud compute config-ssh to automatically add the VMs of your project to your ~/.ssh/config or manually add the public IP of your VM to it. If you skipped step 1. then you have to run gcloud compute config-ssh every time you re-start the remote VM, because it always gets a new IP assigned. The ~/.ssh/config gets populated with many entries in the following format:
Host the-vm-host-name # use this in PyCharm's Host field
HostName 123.456.789.00 # the VM's IP address
Use the Host name of the remote you want to connect in your Deployment configuration in PyCharm
Add a remote interpreter: select the remote server from the drop-down (the one previously created) and point PyCharm to the executable python of your Python installation.
Done
My understanding is that you need the Pycharm Ultimate Edition to support remote servers. If you have Ultimate, then you can follow these instructions.
It's fairly easy to accomplish.
You need:
PyCharm Pro
Create and format SSH keys
Config your Compute Engine instance with the SSH keys
Configure PyCharm
You can follow this tutorial that I wrote.
I had a look at cx_Oracle but I have a couple of problems with it. First , my oracle server is on remote machine. Second I do not know on what platform my software will be deployed. All the examples I have founded
like this
http://www.len.ro/2009/08/cx_oracle-on-ubuntu-9-04-jaunty/
or
this https://stackoverflow.com/questions/592/cx-oracle-how-do-i-access-oracle-from-python
assume to have oracle server on the same machine. Is there possibility to have some static compilation so I can easily move my software from one pc to the other?
thx
Of course cx_Oracle can work with server working on other machine. But on client machines you will have to install Oracle client and configure it. I don't know if Oracle client installation can be added to installer of your application. Normally it is huge (600 MiB or so) so it is not a good idea. Then on all client machines you will have to configure Oracle client: set ORACLE_HOME, run Oracle tools to configure connection with database etc.
The only "light" solution I know is to use JDBC from Jython or Java. In this scenario you can use "thin" version of connect string that requires only some .jar libraries. Such connect string looks like:
db = DriverManager.getConnection('jdbc:oracle:thin:169.0.1.225:1521:test_db', 'user', 'passwd')
On client machines it needs ojdbc6.jar and orai18n.jar on CLASSPATH. No installation, no configuration, simple and easy.