• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. roc1479
    R
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 2
    • Controversial 0
    • Groups 0

    roc1479

    @roc1479

    4
    Reputation
    4
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    roc1479 Unfollow Follow

    Best posts made by roc1479

    • FOG image sync with mysql replication - 2 Servers

      Hi guys,

      I Wanted to share how I use FOG with image sync and mysql replication between 2 different FOG servers.

      Version: 1.5.7 running on Ubuntu 18.04 LTS
      Setup: 2 FOG servers with local storage at 2 different locations (NJ and NC) connected via site to site VPN
      Function: Simple capture and deploy, no management, addons, snapins, groups or hosts.

      I’ve setup MariaDB master master replication and this sync’s: Images, Hosts, Groups, Users, Snapins, Printers and probably more between the 2 FOG servers. I’m sure anything that is stored in mysql will sync.

      I use rsync scheduled via cron to push and pull new image files from the main server. I had problems with the built in replication, so this was the work around.

      Just thought I’d share as this was my way to replicate site to site.

      Rocky

      posted in General
      R
      roc1479
    • RE: FOG image sync with mysql replication - 2 Servers

      @george1421

      FOG - Image Sync with Mysql Master Master Replication

      • If existing FOG servers, export all configured resources from main server (Image templates, hosts, groups, snapins etc).
      • The 2nd FOG server was a new install, so didn’t have any images or data.
      • Built on Ubuntu 18.04 LTS
      • FOG Server 1.5.7

      HOST A (Main):
      sudo nano /etc/mysql/my.cnf with content:

      [mysqld]
      server-id=1
      log-bin=mysql-bin
      bind-address=IPOFHOSTA
      port=3306
      auto_increment_increment=2
      auto_increment_offset=1
      

      Restart Mysql

      sudo systemctl restart mariadb
      

      Create a replication user and grant replication permission

      mysql -u root -p
      create user 'repuser'@'%' identified by 'fogpassword';
      grant replication slave on *.* to 'repuser'@'%';
      flush privileges;
      show master status;
      

      *Note: Make note of BINLOG File name and POS for use setting up HOSTB

      HOST B:
      sudo nano /etc/mysql/my.cnf with content:

      [mysqld]
      server-id=2
      log-bin=mysql-bin
      bind-address=IPOFHOSTB
      port=3306
      auto_increment_increment=2
      auto_increment_offset=2
      

      Restart Mysql

      sudo systemctl restart mariadb
      

      Create a replication user and grant replication permission

      mysql -u root
      create user 'repuser'@'%' identified by 'fogpassword';
      grant replication slave on *.* to 'repuser'@'%';
      stop slave;
      CHANGE MASTER TO MASTER_HOST='IPOFHOSTA', MASTER_USER='repuser', MASTER_PASSWORD='fogpassword', MASTER_LOG_FILE='BINLOGFILENAMEHOSTA', MASTER_LOG_POS=POSHOSTA;
      start slave;
      show master status;
      

      *Note: Make note of BINLOG File name and POS for use setting up HOSTA

      Back on HOST A:
      Setup replication:

      mysql -u root -p
      stop slave;
      CHANGE MASTER TO MASTER_HOST='IPOFHOSTB', MASTER_USER='repuser', MASTER_PASSWORD='fogpassword', MASTER_LOG_FILE ='BINLOGFILENAMEHOSTB', MASTER_LOG_POS=POSHOSTB;
      start slave;
      show slave status \G;
      

      Replication should be working now.

      You can now import your backups, if you had an existing server. If not, just test it by creating an image template on either FOG server. Data should replicate to the other.

      Syncing Images using rsync

      #Push
      rsync -a --no-perms --no-owner --no-group -P --ignore-existing --exclude-from='/opt/excluded.txt' /images/ USER@HOSTBIP:/images/
      
      #Pull
      rsync -a --no-perms --no-owner --no-group -P --ignore-existing --exclude-from='/opt/excluded.txt' USER@HOSTB:/images/ /images/
      

      Excluding files or folders
      sudo nano /opt/excluded.txt

      #Add any files or folder which should be excluded from replication within the images folder
      dev
      lost+found
      postdownloadscripts
      .mntcheck
      

      I use these scripts on the main server to push and pull at schedule intervals.

      contab -e

      #min    hour    dayof month    month    dayof week
      #Push
      0    01    *    *    Wed    /opt/rsync_push.sh
      0    01    *    *    Sat    /opt/rsync_push.sh
      #Pull
      0    06    *    *    Wed    /opt/rsync_pull.sh
      0    01    *    *    Sun    /opt/rsync_pull.sh       
      
      posted in General
      R
      roc1479

    Latest posts made by roc1479

    • RE: FOG image sync with mysql replication - 2 Servers

      @george1421
      No problem, anything to help the community.

      posted in General
      R
      roc1479
    • RE: FOG image sync with mysql replication - 2 Servers

      @george1421

      FOG - Image Sync with Mysql Master Master Replication

      • If existing FOG servers, export all configured resources from main server (Image templates, hosts, groups, snapins etc).
      • The 2nd FOG server was a new install, so didn’t have any images or data.
      • Built on Ubuntu 18.04 LTS
      • FOG Server 1.5.7

      HOST A (Main):
      sudo nano /etc/mysql/my.cnf with content:

      [mysqld]
      server-id=1
      log-bin=mysql-bin
      bind-address=IPOFHOSTA
      port=3306
      auto_increment_increment=2
      auto_increment_offset=1
      

      Restart Mysql

      sudo systemctl restart mariadb
      

      Create a replication user and grant replication permission

      mysql -u root -p
      create user 'repuser'@'%' identified by 'fogpassword';
      grant replication slave on *.* to 'repuser'@'%';
      flush privileges;
      show master status;
      

      *Note: Make note of BINLOG File name and POS for use setting up HOSTB

      HOST B:
      sudo nano /etc/mysql/my.cnf with content:

      [mysqld]
      server-id=2
      log-bin=mysql-bin
      bind-address=IPOFHOSTB
      port=3306
      auto_increment_increment=2
      auto_increment_offset=2
      

      Restart Mysql

      sudo systemctl restart mariadb
      

      Create a replication user and grant replication permission

      mysql -u root
      create user 'repuser'@'%' identified by 'fogpassword';
      grant replication slave on *.* to 'repuser'@'%';
      stop slave;
      CHANGE MASTER TO MASTER_HOST='IPOFHOSTA', MASTER_USER='repuser', MASTER_PASSWORD='fogpassword', MASTER_LOG_FILE='BINLOGFILENAMEHOSTA', MASTER_LOG_POS=POSHOSTA;
      start slave;
      show master status;
      

      *Note: Make note of BINLOG File name and POS for use setting up HOSTA

      Back on HOST A:
      Setup replication:

      mysql -u root -p
      stop slave;
      CHANGE MASTER TO MASTER_HOST='IPOFHOSTB', MASTER_USER='repuser', MASTER_PASSWORD='fogpassword', MASTER_LOG_FILE ='BINLOGFILENAMEHOSTB', MASTER_LOG_POS=POSHOSTB;
      start slave;
      show slave status \G;
      

      Replication should be working now.

      You can now import your backups, if you had an existing server. If not, just test it by creating an image template on either FOG server. Data should replicate to the other.

      Syncing Images using rsync

      #Push
      rsync -a --no-perms --no-owner --no-group -P --ignore-existing --exclude-from='/opt/excluded.txt' /images/ USER@HOSTBIP:/images/
      
      #Pull
      rsync -a --no-perms --no-owner --no-group -P --ignore-existing --exclude-from='/opt/excluded.txt' USER@HOSTB:/images/ /images/
      

      Excluding files or folders
      sudo nano /opt/excluded.txt

      #Add any files or folder which should be excluded from replication within the images folder
      dev
      lost+found
      postdownloadscripts
      .mntcheck
      

      I use these scripts on the main server to push and pull at schedule intervals.

      contab -e

      #min    hour    dayof month    month    dayof week
      #Push
      0    01    *    *    Wed    /opt/rsync_push.sh
      0    01    *    *    Sat    /opt/rsync_push.sh
      #Pull
      0    06    *    *    Wed    /opt/rsync_pull.sh
      0    01    *    *    Sun    /opt/rsync_pull.sh       
      
      posted in General
      R
      roc1479
    • FOG image sync with mysql replication - 2 Servers

      Hi guys,

      I Wanted to share how I use FOG with image sync and mysql replication between 2 different FOG servers.

      Version: 1.5.7 running on Ubuntu 18.04 LTS
      Setup: 2 FOG servers with local storage at 2 different locations (NJ and NC) connected via site to site VPN
      Function: Simple capture and deploy, no management, addons, snapins, groups or hosts.

      I’ve setup MariaDB master master replication and this sync’s: Images, Hosts, Groups, Users, Snapins, Printers and probably more between the 2 FOG servers. I’m sure anything that is stored in mysql will sync.

      I use rsync scheduled via cron to push and pull new image files from the main server. I had problems with the built in replication, so this was the work around.

      Just thought I’d share as this was my way to replicate site to site.

      Rocky

      posted in General
      R
      roc1479