Author Topic: Feature Request - Database relocation  (Read 22348 times)

RichardP

  • Veteran
  • ***
  • Posts: 131
    • View Profile
Re: Feature Request - Database relocation
« Reply #30 on: February 18, 2008, 01:19:10 am »
Ah, but you are moving the database location on the core, we are not talking about moving the daemon (server).  The servername for all the scripts and programs is the core, whether it is referenced as 127.0.0.1,

You may be leaving the server in the same location, but I'm not  ;D

I'd like to have the DB running on a server which is already running both MySQL and PostgreSql, and which already has a both a tape drive and a backup plan running. Makes my maintenance easier, and also means I can nuke my system without hesitation when upgrading either software or hardware. I realise this is not for everyone, though.

Best Regards,
Richard.
Best Regards,
Richard

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: Feature Request - Database relocation
« Reply #31 on: February 18, 2008, 02:41:30 am »
Ah, but you are moving the database location on the core, we are not talking about moving the daemon (server).  The servername for all the scripts and programs is the core, whether it is referenced as 127.0.0.1,

You may be leaving the server in the same location, but I'm not  ;D

I'd like to have the DB running on a server which is already running both MySQL and PostgreSql, and which already has a both a tape drive and a backup plan running. Makes my maintenance easier, and also means I can nuke my system without hesitation when upgrading either software or hardware. I realise this is not for everyone, though.

It might not be for everyone, but neither am I ;). Let me know how it goes, and if you want to collaborate on the switchover. Especially if you want to work on some way to base LMCE's data in Postgres, whether or not you keep MySQL. That's what I want too, but I can't prioritize working on it directly.

cybernard

  • Regular Poster
  • **
  • Posts: 24
    • View Profile
Re: Feature Request - Database relocation
« Reply #32 on: May 07, 2008, 06:12:38 pm »
*****Before dumping bring the database offline so no one can use it.*****
Otherwise you may have doom and disaster
I recommend unplugging the cable from all NIC(s) during the mysqldump process.
I assume NO LIABILITY of any kind, but I have done this before for other programs.

LinuxMCE PC

mysqldump -c -u <username> -p <database name>  >/path-of output/linuxmce-backup.sql
Obviously you need to supply valid credentials including password.

There is a command line switch to dump all databases, but I forgot what that was try mysqldump --help.
(something like --all-databases)

You may/or may not have to add "connect <database name>;" as the first line of code.  If you use the all switch you won't have to, but if you use the "all" you could wipe out existing username and passwords if your not careful.  ***If both systems have a user joe some of the data could be overlayed especially the password.**
***Other bad things can occur****

copy linuxmce-backup.sql to your other machine.

I also recommend(strongly!!) using the same procedure to back up your other database in case something goes horribly wrong.

You need to find and use the "all database" switch for your original database, on the destination pc, because that will backup usernames,passwords, and permissions.

Destination PC

EITHER
mysqldump -c -u <username> -p <database name>  >/path-of output/orginal-db-on-destination-pc.sql
OR (better)
mysqldump -c -u <username> -p --all-databases  >/path-of output/orginal-db-on-destination-pc.sql

Using the same steps with a different filename.


Now hopefully you backed up both of them in case of disaster.
No backup=No recovery



mysql -u <username> -p <database name> /path-to existing file/linuxmce-backup.sql
If your doing all you omitted the database name.

Specify credentials and wait for the process to complete.

If something goes horribly wrong you'll be glad you backed up.
---In case of doom as disaster:----------
mysql -u root -p
delete each affect database one at a time
commit;
exit or bye I forget which.
mysql -u root -p <database name> </path-of output/orginal-db-on-destination-pc.sql
Specify credentials and wait for the process to complete.
You are now restored
---End of doom and disaster---------------

I have no idea where the setting is located, but all thats left is to change the IP address that LinuxMCE is trying to connect to from localhost to the ip address of your other machine and your done.
Assuming you found this location you and now migrated.

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Feature Request - Database relocation
« Reply #33 on: May 09, 2008, 08:22:09 pm »
I have no idea where the setting is located, but all thats left is to change the IP address that LinuxMCE is trying to connect to from localhost to the ip address of your other machine and your done.
Assuming you found this location you and now migrated.


good one ;)

*LMAO*
rock your home - http://www.agocontrol.com home automation

cybernard

  • Regular Poster
  • **
  • Posts: 24
    • View Profile
Re: Feature Request - Database relocation
« Reply #34 on: May 12, 2008, 10:09:12 pm »
If you can't find the setting, use iptables to generate a NAT rule to foward the traffic.  If you don't know iptables use Firewall builder(30 day trail ediition) from fwbuilder.com to generate the necessary rules yourself the necessary iptable's settings through a nice windows GUI.  Route any "source" with 127.0.0.1 as the destination and 3306 as the service to the ip address of the new database with the original service.  Then save and compile.  You will get a .fw file which you can execute in a terminal window on your LinuxMCE box.  The script will have to be executed upon any reboot of the box.