SlideShare uma empresa Scribd logo
1 de 37
Subversion on-the-fly replication
Do it like the Apache Software Foundation Infrastructure
                          Team
                       Norman Maurer

                     ApacheCon EU 2009
                       March 27, 2009
Norman Maurer
     Member of the Apache Software Foundation
 

     Apache Software Foundation Infrastructure Team
 

     PMC Apache JAMES
 

     Senior Unix System Engineer
 




                                   norman@apache.org
                                   norman.maurer@heagmedianet.de
                                   http://www.heagmedianet.com
                                   http://myblog.kicks-ass.org


                                                                   2
Subversion – The
Opensource Version
  Control System
 Keep track of your sourcecode




                                 3
What are the benefits of using Subversion


      Opensource
  



      Runs many OS
  



      Flexible plugin mechanism via hooks
  



      Very good integration with IDEs
  



      Many users / Well tested
  




                                            4
Replication
 Replicate Repositories on
as many servers as you like




                              5
Benefits when using Subversion
replication

       Copy of the data on more than one server
   



       Eliminate single point of failure
   



       Share load across servers
   



       Repositories on many different GEO locations
   



       Works with the usual load balancers in front
   



       READ / WRITE possible
   



                                                      6
Drawbacks of using Subversion
replication

       When the primary node fails, no commits are
   

       possible, but read-only still works ;)

       Big commits can take some time to replay to
   

       slaves

       Importing dumps will mean the slaves become
   

       out of sync!

       More servers to maintain
   




                                                     7
How it works – The concept
 Replication

                                         Commit
                            Subversion
               svn commit                 pass-
                            Slave
                                         through


 Users                                                     Subversion
                                                           Master
               svn update       Replay
                               changes

                                  svn commit                  svn update




                                                   Users
                                                                           8
Putting stuff together
  Installing all the needed bits




                                   9
Installation of Apache HTTP

       Ubuntu / Debian
   

       # apt-get install apache2

       Freebsd
   

       # portinstall apache22

       Others
   

       Check if there are prebuilt packages / build it on your
       own!
       Make sure you compile apache2 with mod_proxy
       support included.



                                                                 10
Installation of Subversion and
Apache HTTP module
       Ubuntu / Debian
   

       # apt-get install subversion libapache2-svn

       Freebsd
   

       # portinstall -m “-DMOD_DAV_SVN“ subversion

       Others
   

       Check if there are prebuilt packages / build it yourself
       from source




                                                                  11
Create the Subversion Repository

       Create Parent Directory
   

       # mkdir /path/to/repos-parent
       # chown $wwwuser:$wwwgroup -R /path/to/repos-parent
       # chmod 770 -R /path/to/repos-parent

       Create Repository
   

       # su $wwwuser -c 'svnadmin create /path/to/repository'




                                                                12
Setup the Master
Version-Control for all your data




                                    13
Configuration of Apache HTTP on the Master

       Setup Apache HTTPD config
   


                                                          Make sure
       # /path/to/apache/httpd.conf
       LoadModule dav_svn_module modules/mod_dav_svn.so
                                                          Subversion
       .......
                                                          module is loaded
       <Location /repos>
                                                          on startup
                DAV svn
                SVNPath /path/to/repos
                AuthName quot;SVN Reposquot;
                                                          Subversion
                AuthType Basic
                                                          Repository
                AuthBasicProvider file
                AuthUserFile /path/to/auth-file
                Require valid-user
       </Location>




                                                                         14
Setup the Slave
Mirror of your Main Subversion Repository




                                            15
Configuration of Apache HTTPD on the Slave

       Modify Apache HTTPD config
   


       # /path/to/apache/httpd.conf
                                                          Make sure
       LoadModule dav_svn_module modules/mod_dav_svn.so
                                                          Subversion
       .......
       <Location /repos>
                                                          module is loaded
                DAV svn
                                                          on startup
                SVNPath /path/to/repos
                SVNMasterURI http://<MASTER>/repos
                AuthName quot;SVN Reposquot;
                AuthType Basic
                                                          Subversion Master
                AuthBasicProvider file
                                                          Repository
                AuthUserFile /path/to/auth-file
                Require valid-user
       </Location>
       <Location /repos/proxy-sync>
                DAV svn
                                                          Subversion Sync
                SVNPath /path/to/repos
                Order deny,allow
                                                          Location
                Deny from all
                Allow from <MASTER>
       </Location>

                                                                            16
Add Subversion hooks

      Add hook on Slave
  


      #/!bin/sh
      #/path/to/repos/hooks/pre-revprop-change
                                                                 Limit revprop
      USER=$3
                                                                 changes to the
      if [ quot;$USERquot; != quot;svnsyncquot; ]; then
                                                                 svnsync user
          echo >&2 quot;Only the svnsync user is allowed to change
      revpropsquot;
          exit 1
      fi

      exit 0




                                                                              17
Set the correct permissions and group

       Make sure the hooks are owned by the right
   

       group
       slave# chgrp $wwwgroup /path/to/repos/hooks/pre-
       revprop-change

       Get sure the hooks are executable
   

       slave# chmod 750 /path/to/repos/hooks/pre-revprop-
       change




                                                            18
Final steps
Last steps to complete replication




                                     19
Init the Slave Repository

       Init the Slave Repository to set properties
   

       master# svnsync --source-username=svnsync --sync-
       username=svnsync init http://<SLAVE>/repos
       http://<MASTER>/repos

       Check if this was successful
   

       master# svn propget svn:sync-from-url --revprop -r 0
       http://<SLAVE>/repos

                                             This should return
                                             the url to the master
                                             repository

                                                                     20
First replication to the Slave Repository

       First sync should probably be started in a
   

       “screen“ session, because it will take some time
       master# screen

       Start the initial sync by hand
   

       master# svnsync --source-username=svnsync --sync-
       username=svnsync sync http://<SLAVE>/repos



                                            Sync started!


                                                            21
Add Subversion hooks to the Master for
on-the-fly replication
       Add hooks needed for replication
   

       #/!bin/sh
                                                               Sync revprop
       #/path/to/repos/hooks/post-revprop-change
                                                               changes to Slave via
       REV=$2
       /path/to/svnsync --source-username=svnsync --sync-
                                                               svnsync
       username=svnsync http://<SLAVE>/repos/proxy-sync $REV
       2>>/var/log/svnsynclog &


       #!/bin/sh                                               Sync commits to
       #/path/to/repos/hooks/post-commit
                                                               Slave via svnsync
       /path/to/svnsync --source-username=svnsync --sync-
       username=svnsync sync http://<SLAVE>/repos/proxy-sync
       2>>/var/log/svnsynclog &




                                                                               22
Set the correct permissions and group

       Make sure the hooks are owned by the right
   

       group
       master# chgrp $wwwgroup /path/to/repos/hooks/post-
       revprop-change
       master# chgrp $wwwgroup /path/to/repos/hooks/post-
       commit

       Get sure the hooks are executable
   

       master# chmod 750 /path/to/repos/hooks/post-revprop-
       change
       master# chmod 750 /path/to/repos/hooks/post-commit



                                                              23
Subversion Replication in
        Production
Our setup within the Apache Software Foundation




                                                  24
Details about the setup – Part I

       Master / Slave
   

       OS:                   FreeBSD-7.0
       Filesystem:           ZFS (raidz2)
       Repository Size:      ~65GB
       Apache HTTPD:         2.2.11
       Subversion:           1.5.5

       Master
   

                             3500000 – 4500000
       Hits/day:
       SVN-Operations/day:   200000 - 250000

       Slave
   

                             70000 – 130000
       Hits/day:
       SVN-Operations/day:   9000 - 90000

                                                 25
Details about the setup – Part II

       Different GEO Locations
   

       Master:                   US (OSUOSL)
       Slave:                    EU (SARA)




                                               26
Known problems
Problems we saw at Apache Software Foundation




                                                27
Problems with file locking – Part I

       File locking will not work well enough with
   

       svnsync
       Use this locking utility written by Joe Schaefer




                                               See „Useful
                                               resources“ for
                                               download link




                                                                28
Problems with file locking – Part II

       Svnsync died but the lock file is still present
   

       Delete lock file and wait for the resync
                                                 Make sure
       master# ps aux | grep svnsync             svnsync is
                                                 not running
       master# svn proplist --
       username=$syncuser --revprop -r0
       http://$slave/repos/proxy-sync/ | grep
                                                 Check for
       svn:sync-lock
                                                 lock
       master# svn propdel svn:sync-lock --
       username=$syncuser --revprop -r0
       http://$slave/repos/proxy-sync/
                                                 Delete
                                                 the lock      29
Out-of-sync on big commits / imports

       Commit to slave server is not possible due to
   

       the out-of-sync of revisions
       Nothing can really help here, but here are
       some suggestions:
             Schedule big imports to low-traffic time
         

             Notify your users about the “downtime“ if
         

             neccessary
             Poke the Subversion Development Team to
         

             better handle such situations in the next
             release=P



                                                         30
Other useful stuff
Random stuff you maybe find useful, just as we
                   did!




                                                 31
Monitoring

       Monitor the sync-state of your repositories with
   

       Nagios
       Send notification if the repositories are out-of-
       sync!
       SVN=/usr/bin/svn
       GREP=/bin/grep
       CUT=/usr/bin/cut
       MASTER_SVN=$1
       SLACK=10
                                                         See „Useful
       SLAVE_ERROR=
                                                         resources“ for
       # check if needed args are given
                                                         download link
       if [ $# -gt 1 ]
       then
           # get the revision of the master repos
           MASTER_REV=`$SVN info $MASTER_SVN | grep -i
       ^revision | cut -f2 -d ' '`
       .....

                                                                          32
Useful resources

       Apache HTTPD
   
       http://httpd.apache.org


       Subversion
   
       http://subversion.tigris.org



       Better Locking script
   
       http://people.apache.org/~norman/talks/setlock.pl


       Nagios monitoring script
   
       http://people.apache.org/~norman/talks/check_svn_replication.sh



                                                                         33
Questions at all?




                    34
Some last words....
     Listen carefully




                        35
Some last words...

 Please use the closest Subversion Server to help
 us..

       lower the load on svn.apache.org
   

       split the bandwidth
   

       improve our setup
   




                                                    36
Thank you for your attention!




                                37

Mais conteúdo relacionado

Mais procurados

NFV : Virtual Network Function Architecture
NFV : Virtual Network Function ArchitectureNFV : Virtual Network Function Architecture
NFV : Virtual Network Function Architecture
sidneel
 

Mais procurados (20)

Resiliency vs High Availability vs Fault Tolerance vs Reliability
Resiliency vs High Availability vs Fault Tolerance vs  ReliabilityResiliency vs High Availability vs Fault Tolerance vs  Reliability
Resiliency vs High Availability vs Fault Tolerance vs Reliability
 
Upgrading to VMware vSphere 6.0
Upgrading to VMware vSphere 6.0Upgrading to VMware vSphere 6.0
Upgrading to VMware vSphere 6.0
 
L4교육자료
L4교육자료L4교육자료
L4교육자료
 
How to Split Your System into Microservices
How to Split Your System into MicroservicesHow to Split Your System into Microservices
How to Split Your System into Microservices
 
Microservices Decomposition Patterns
Microservices Decomposition PatternsMicroservices Decomposition Patterns
Microservices Decomposition Patterns
 
Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018
 
Azure Spring Cloud Workshop - June 17, 2020
Azure Spring Cloud Workshop - June 17, 2020Azure Spring Cloud Workshop - June 17, 2020
Azure Spring Cloud Workshop - June 17, 2020
 
TEMA 1 - Conceptos de OSPFv2 de área única.pdf
TEMA 1 - Conceptos de OSPFv2 de área única.pdfTEMA 1 - Conceptos de OSPFv2 de área única.pdf
TEMA 1 - Conceptos de OSPFv2 de área única.pdf
 
Flexible Data Centre Fabric - FabricPath/TRILL, OTV, LISP and VXLAN
Flexible Data Centre Fabric - FabricPath/TRILL, OTV, LISP and VXLANFlexible Data Centre Fabric - FabricPath/TRILL, OTV, LISP and VXLAN
Flexible Data Centre Fabric - FabricPath/TRILL, OTV, LISP and VXLAN
 
Certificate Management on pfSense 2.4 - pfSense Hangout September 2017
Certificate Management on pfSense 2.4 - pfSense Hangout September 2017Certificate Management on pfSense 2.4 - pfSense Hangout September 2017
Certificate Management on pfSense 2.4 - pfSense Hangout September 2017
 
Microservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudMicroservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring Cloud
 
NFV : Virtual Network Function Architecture
NFV : Virtual Network Function ArchitectureNFV : Virtual Network Function Architecture
NFV : Virtual Network Function Architecture
 
Cloud, SDN, NFV
Cloud, SDN, NFVCloud, SDN, NFV
Cloud, SDN, NFV
 
Cisco Live Brksec 3032 - NGFW Clustering
Cisco Live Brksec 3032 - NGFW ClusteringCisco Live Brksec 3032 - NGFW Clustering
Cisco Live Brksec 3032 - NGFW Clustering
 
Create Your Own Serverless PKI with .NET & Azure Key Vault
Create Your Own Serverless PKI with .NET & Azure Key VaultCreate Your Own Serverless PKI with .NET & Azure Key Vault
Create Your Own Serverless PKI with .NET & Azure Key Vault
 
SDN입문 (Overlay and Underlay)
SDN입문 (Overlay and Underlay)SDN입문 (Overlay and Underlay)
SDN입문 (Overlay and Underlay)
 
PXEless Discovery with Foreman
PXEless Discovery with ForemanPXEless Discovery with Foreman
PXEless Discovery with Foreman
 
Vpn site to site
Vpn site to siteVpn site to site
Vpn site to site
 
23.06.15 NSX ALB and vCD integration deepdive_webinar0615.pptx
23.06.15 NSX ALB and vCD integration deepdive_webinar0615.pptx23.06.15 NSX ALB and vCD integration deepdive_webinar0615.pptx
23.06.15 NSX ALB and vCD integration deepdive_webinar0615.pptx
 
VMware NSX - Lessons Learned from real project
VMware NSX - Lessons Learned from real projectVMware NSX - Lessons Learned from real project
VMware NSX - Lessons Learned from real project
 

Destaque

new-product-development-process
new-product-development-processnew-product-development-process
new-product-development-process
arunalapati
 
High Availability != High-cost
High Availability != High-costHigh Availability != High-cost
High Availability != High-cost
normanmaurer
 
Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with Netty
Daniel Bimschas
 
structural-packaging-josep-m-garrofe
 structural-packaging-josep-m-garrofe structural-packaging-josep-m-garrofe
structural-packaging-josep-m-garrofe
Anirudh Chaiworaporn
 

Destaque (20)

Netty4
Netty4Netty4
Netty4
 
Saudi Arabia’s National Open Education Strategy, Master Plan & Policy
Saudi Arabia’s National Open Education Strategy, Master Plan & PolicySaudi Arabia’s National Open Education Strategy, Master Plan & Policy
Saudi Arabia’s National Open Education Strategy, Master Plan & Policy
 
time-management-ppt
time-management-ppttime-management-ppt
time-management-ppt
 
new-product-development-process
new-product-development-processnew-product-development-process
new-product-development-process
 
Forrester On Using Subversion to Optimize Globally Distributed Development
Forrester On Using Subversion to Optimize Globally Distributed DevelopmentForrester On Using Subversion to Optimize Globally Distributed Development
Forrester On Using Subversion to Optimize Globally Distributed Development
 
High Availability != High-cost
High Availability != High-costHigh Availability != High-cost
High Availability != High-cost
 
How To Produce A Short Film By Conor Barry SP Films
How To Produce A Short Film By Conor Barry SP FilmsHow To Produce A Short Film By Conor Barry SP Films
How To Produce A Short Film By Conor Barry SP Films
 
M&amp;R Poster P1 Event Manager Website Rajopadhye Mhatre Nimmagadda
M&amp;R Poster P1 Event Manager Website Rajopadhye Mhatre NimmagaddaM&amp;R Poster P1 Event Manager Website Rajopadhye Mhatre Nimmagadda
M&amp;R Poster P1 Event Manager Website Rajopadhye Mhatre Nimmagadda
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with netty
 
Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with Netty
 
Integrated Marketing Communication
Integrated Marketing Communication Integrated Marketing Communication
Integrated Marketing Communication
 
Checking Progress On Your Lean Journey
Checking Progress On Your Lean JourneyChecking Progress On Your Lean Journey
Checking Progress On Your Lean Journey
 
Action research
Action researchAction research
Action research
 
Subversion User Guide
Subversion User GuideSubversion User Guide
Subversion User Guide
 
Approaching Galleries & Proposal Writing for Artists
Approaching Galleries & Proposal Writing for ArtistsApproaching Galleries & Proposal Writing for Artists
Approaching Galleries & Proposal Writing for Artists
 
セキュリティを重視した本格ビジネスサイトをWordPressで作るためのセミナー
セキュリティを重視した本格ビジネスサイトをWordPressで作るためのセミナーセキュリティを重視した本格ビジネスサイトをWordPressで作るためのセミナー
セキュリティを重視した本格ビジネスサイトをWordPressで作るためのセミナー
 
structural-packaging-josep-m-garrofe
 structural-packaging-josep-m-garrofe structural-packaging-josep-m-garrofe
structural-packaging-josep-m-garrofe
 
visionary leaders
visionary leadersvisionary leaders
visionary leaders
 
SEEA Agriculture Forestry and Fisheries Accounting Tools: Accounting Exercises
SEEA Agriculture Forestry and Fisheries Accounting Tools: Accounting ExercisesSEEA Agriculture Forestry and Fisheries Accounting Tools: Accounting Exercises
SEEA Agriculture Forestry and Fisheries Accounting Tools: Accounting Exercises
 
The 5 dysfunctions of a team Management Presentation
The 5 dysfunctions of a team Management PresentationThe 5 dysfunctions of a team Management Presentation
The 5 dysfunctions of a team Management Presentation
 

Semelhante a Subversion on-the-fly replication

Ubuntu安装SVN总结
Ubuntu安装SVN总结Ubuntu安装SVN总结
Ubuntu安装SVN总结
wensheng wei
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
ByPat博客出品Lvs+keepalived
ByPat博客出品Lvs+keepalivedByPat博客出品Lvs+keepalived
ByPat博客出品Lvs+keepalived
redhat9
 
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Lucidworks
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 
Setting up and open fidy dev environment
Setting up and open fidy dev environmentSetting up and open fidy dev environment
Setting up and open fidy dev environment
ianibbo
 

Semelhante a Subversion on-the-fly replication (20)

Ubuntu安装SVN总结
Ubuntu安装SVN总结Ubuntu安装SVN总结
Ubuntu安装SVN总结
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Usando o Cloud
Usando o CloudUsando o Cloud
Usando o Cloud
 
ByPat博客出品Lvs+keepalived
ByPat博客出品Lvs+keepalivedByPat博客出品Lvs+keepalived
ByPat博客出品Lvs+keepalived
 
Svn Subversion
Svn SubversionSvn Subversion
Svn Subversion
 
Capistrano
CapistranoCapistrano
Capistrano
 
4. open mano set up and usage
4. open mano set up and usage4. open mano set up and usage
4. open mano set up and usage
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for Developers
 
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
 
Subversionn Introduction at SuperMondays 2009-09-01
Subversionn Introduction at SuperMondays 2009-09-01Subversionn Introduction at SuperMondays 2009-09-01
Subversionn Introduction at SuperMondays 2009-09-01
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Setting up and open fidy dev environment
Setting up and open fidy dev environmentSetting up and open fidy dev environment
Setting up and open fidy dev environment
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Subversion on-the-fly replication

  • 1. Subversion on-the-fly replication Do it like the Apache Software Foundation Infrastructure Team Norman Maurer ApacheCon EU 2009 March 27, 2009
  • 2. Norman Maurer Member of the Apache Software Foundation  Apache Software Foundation Infrastructure Team  PMC Apache JAMES  Senior Unix System Engineer  norman@apache.org norman.maurer@heagmedianet.de http://www.heagmedianet.com http://myblog.kicks-ass.org 2
  • 3. Subversion – The Opensource Version Control System Keep track of your sourcecode 3
  • 4. What are the benefits of using Subversion Opensource  Runs many OS  Flexible plugin mechanism via hooks  Very good integration with IDEs  Many users / Well tested  4
  • 5. Replication Replicate Repositories on as many servers as you like 5
  • 6. Benefits when using Subversion replication Copy of the data on more than one server  Eliminate single point of failure  Share load across servers  Repositories on many different GEO locations  Works with the usual load balancers in front  READ / WRITE possible  6
  • 7. Drawbacks of using Subversion replication When the primary node fails, no commits are  possible, but read-only still works ;) Big commits can take some time to replay to  slaves Importing dumps will mean the slaves become  out of sync! More servers to maintain  7
  • 8. How it works – The concept Replication Commit Subversion svn commit pass- Slave through Users Subversion Master svn update Replay changes svn commit svn update Users 8
  • 9. Putting stuff together Installing all the needed bits 9
  • 10. Installation of Apache HTTP Ubuntu / Debian  # apt-get install apache2 Freebsd  # portinstall apache22 Others  Check if there are prebuilt packages / build it on your own! Make sure you compile apache2 with mod_proxy support included. 10
  • 11. Installation of Subversion and Apache HTTP module Ubuntu / Debian  # apt-get install subversion libapache2-svn Freebsd  # portinstall -m “-DMOD_DAV_SVN“ subversion Others  Check if there are prebuilt packages / build it yourself from source 11
  • 12. Create the Subversion Repository Create Parent Directory  # mkdir /path/to/repos-parent # chown $wwwuser:$wwwgroup -R /path/to/repos-parent # chmod 770 -R /path/to/repos-parent Create Repository  # su $wwwuser -c 'svnadmin create /path/to/repository' 12
  • 13. Setup the Master Version-Control for all your data 13
  • 14. Configuration of Apache HTTP on the Master Setup Apache HTTPD config  Make sure # /path/to/apache/httpd.conf LoadModule dav_svn_module modules/mod_dav_svn.so Subversion ....... module is loaded <Location /repos> on startup DAV svn SVNPath /path/to/repos AuthName quot;SVN Reposquot; Subversion AuthType Basic Repository AuthBasicProvider file AuthUserFile /path/to/auth-file Require valid-user </Location> 14
  • 15. Setup the Slave Mirror of your Main Subversion Repository 15
  • 16. Configuration of Apache HTTPD on the Slave Modify Apache HTTPD config  # /path/to/apache/httpd.conf Make sure LoadModule dav_svn_module modules/mod_dav_svn.so Subversion ....... <Location /repos> module is loaded DAV svn on startup SVNPath /path/to/repos SVNMasterURI http://<MASTER>/repos AuthName quot;SVN Reposquot; AuthType Basic Subversion Master AuthBasicProvider file Repository AuthUserFile /path/to/auth-file Require valid-user </Location> <Location /repos/proxy-sync> DAV svn Subversion Sync SVNPath /path/to/repos Order deny,allow Location Deny from all Allow from <MASTER> </Location> 16
  • 17. Add Subversion hooks Add hook on Slave  #/!bin/sh #/path/to/repos/hooks/pre-revprop-change Limit revprop USER=$3 changes to the if [ quot;$USERquot; != quot;svnsyncquot; ]; then svnsync user echo >&2 quot;Only the svnsync user is allowed to change revpropsquot; exit 1 fi exit 0 17
  • 18. Set the correct permissions and group Make sure the hooks are owned by the right  group slave# chgrp $wwwgroup /path/to/repos/hooks/pre- revprop-change Get sure the hooks are executable  slave# chmod 750 /path/to/repos/hooks/pre-revprop- change 18
  • 19. Final steps Last steps to complete replication 19
  • 20. Init the Slave Repository Init the Slave Repository to set properties  master# svnsync --source-username=svnsync --sync- username=svnsync init http://<SLAVE>/repos http://<MASTER>/repos Check if this was successful  master# svn propget svn:sync-from-url --revprop -r 0 http://<SLAVE>/repos This should return the url to the master repository 20
  • 21. First replication to the Slave Repository First sync should probably be started in a  “screen“ session, because it will take some time master# screen Start the initial sync by hand  master# svnsync --source-username=svnsync --sync- username=svnsync sync http://<SLAVE>/repos Sync started! 21
  • 22. Add Subversion hooks to the Master for on-the-fly replication Add hooks needed for replication  #/!bin/sh Sync revprop #/path/to/repos/hooks/post-revprop-change changes to Slave via REV=$2 /path/to/svnsync --source-username=svnsync --sync- svnsync username=svnsync http://<SLAVE>/repos/proxy-sync $REV 2>>/var/log/svnsynclog & #!/bin/sh Sync commits to #/path/to/repos/hooks/post-commit Slave via svnsync /path/to/svnsync --source-username=svnsync --sync- username=svnsync sync http://<SLAVE>/repos/proxy-sync 2>>/var/log/svnsynclog & 22
  • 23. Set the correct permissions and group Make sure the hooks are owned by the right  group master# chgrp $wwwgroup /path/to/repos/hooks/post- revprop-change master# chgrp $wwwgroup /path/to/repos/hooks/post- commit Get sure the hooks are executable  master# chmod 750 /path/to/repos/hooks/post-revprop- change master# chmod 750 /path/to/repos/hooks/post-commit 23
  • 24. Subversion Replication in Production Our setup within the Apache Software Foundation 24
  • 25. Details about the setup – Part I Master / Slave  OS: FreeBSD-7.0 Filesystem: ZFS (raidz2) Repository Size: ~65GB Apache HTTPD: 2.2.11 Subversion: 1.5.5 Master  3500000 – 4500000 Hits/day: SVN-Operations/day: 200000 - 250000 Slave  70000 – 130000 Hits/day: SVN-Operations/day: 9000 - 90000 25
  • 26. Details about the setup – Part II Different GEO Locations  Master: US (OSUOSL) Slave: EU (SARA) 26
  • 27. Known problems Problems we saw at Apache Software Foundation 27
  • 28. Problems with file locking – Part I File locking will not work well enough with  svnsync Use this locking utility written by Joe Schaefer See „Useful resources“ for download link 28
  • 29. Problems with file locking – Part II Svnsync died but the lock file is still present  Delete lock file and wait for the resync Make sure master# ps aux | grep svnsync svnsync is not running master# svn proplist -- username=$syncuser --revprop -r0 http://$slave/repos/proxy-sync/ | grep Check for svn:sync-lock lock master# svn propdel svn:sync-lock -- username=$syncuser --revprop -r0 http://$slave/repos/proxy-sync/ Delete the lock 29
  • 30. Out-of-sync on big commits / imports Commit to slave server is not possible due to  the out-of-sync of revisions Nothing can really help here, but here are some suggestions: Schedule big imports to low-traffic time  Notify your users about the “downtime“ if  neccessary Poke the Subversion Development Team to  better handle such situations in the next release=P 30
  • 31. Other useful stuff Random stuff you maybe find useful, just as we did! 31
  • 32. Monitoring Monitor the sync-state of your repositories with  Nagios Send notification if the repositories are out-of- sync! SVN=/usr/bin/svn GREP=/bin/grep CUT=/usr/bin/cut MASTER_SVN=$1 SLACK=10 See „Useful SLAVE_ERROR= resources“ for # check if needed args are given download link if [ $# -gt 1 ] then # get the revision of the master repos MASTER_REV=`$SVN info $MASTER_SVN | grep -i ^revision | cut -f2 -d ' '` ..... 32
  • 33. Useful resources Apache HTTPD  http://httpd.apache.org Subversion  http://subversion.tigris.org Better Locking script  http://people.apache.org/~norman/talks/setlock.pl Nagios monitoring script  http://people.apache.org/~norman/talks/check_svn_replication.sh 33
  • 35. Some last words.... Listen carefully 35
  • 36. Some last words... Please use the closest Subversion Server to help us.. lower the load on svn.apache.org  split the bandwidth  improve our setup  36
  • 37. Thank you for your attention! 37