Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

lsyncd rsync web servers.

Posted on 2013-05-24
11
Medium Priority
?
2,376 Views
Last Modified: 2013-05-24
Hi guys,
Very new to Linux, so be gentle and spell things out for me ;)

System
2 x Centos servers (Master, Slave)

both host the same website sitting behind a loadbalancer (Least active connections).

I keep the servers in replicating the Master to the Slave.
Using Lsyncd.

Issue:-
all is working, however when files/directories transfer to the slave their owner and group change to root:root.
I can fix it by using chown, but would like it if they kept there owner:group (they are same on both machines) or inherited from their parent directory. Either would do.

here is a copy of /etc/lsyncd.lua
settings {
   logfile = "/var/log/lsyncd/lsyncd.log",
   statusFile = "/var/log/lsyncd/lsyncd-status.log",
   statusInterval = 2
}

sync {
	default.rsync,
	source="/home/mysite/public_html/",
	target="10.176.6.23:/home/mysite/public_html/",
	excludeFrom="/etc/lsyncd-excludes.txt",
	rsync = {
		compress = true,
		acls = true,
		verbose = true,
		rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"
	}
}

Open in new window


Any assistance would be appreciated.

Cheers
Andrew
0
Comment
Question by:Andrew Davis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39194022
Include

rsyncOpts="-lptgoD"

inside this block:


rsync = {
            compress = true,
            acls = true,
            verbose = true,
            rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"
            rsyncOpts="-lptgoD"
      }


See "man rsync" for the meaning of the single option letters.

In brief:

l = copy symlinks as symlinks
p = preserve permissions
t = preserve modification times
g = preserve group
o = preserve owner
D = preserve device files / preserve special files

This will have no effect on existing files, so best start over with empty target directories.
0
 
LVL 18

Author Comment

by:Andrew Davis
ID: 39194474
now i get the error:

Starting lsyncd: Error: error loading /etc/lsyncd.lua: /etc/lsyncd.lua:17: '}' expected (to close '{' at line 12) near 'rsyncOpts'

Double checked all the close brackets are there, an if i just delete the line rsyncOpts="-lptgoD"

I can then start the service again. Makes no sense. If it matters I am using nano to edit.

Cheers
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39194500
Sorry, I made a mistake when posting the example - there is a comma missing past
rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"

rsync = {
            compress = true,
            acls = true,
            verbose = true,
            rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no",
            rsyncOpts="-lptgoD"
      }
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 18

Author Comment

by:Andrew Davis
ID: 39194516
That makes sense ;)

Now i get

Starting lsyncd: Error: error preparing /etc/lsyncd.lua: Parameter "rsync.rsyncOpts" unknown. (if this is not a typo add it to checkgauge)

Duh :(
0
 
LVL 18

Author Comment

by:Andrew Davis
ID: 39194539
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39194575
OK,

seems the've introduced a new set of parameters with lsyncd 2.1.

So try the single options as described in your link, like "owner", "perms" etc.

You could also try "archive=true" which should include all required flags (if it's at all comparable to the rsync option "--archive", that is).
0
 
LVL 18

Author Comment

by:Andrew Davis
ID: 39194586
tried

owner = true,
perms = true

This did the owner but not the group :(
Would be nice if they gave you a bit of a description as to what each setting is.
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 39194605
Strange.

Maybe they just forgot to mention "group" in their docs??

I'd try "group=true" and also "archive=true" and see what happens.
0
 
LVL 18

Author Comment

by:Andrew Davis
ID: 39194613
Thanks heaps for your assistance.

I tried the Archive = True (it wasnt mentioned either) and this worked.
I will give "group" a try out of curiosity. Hell what else am i going to do while waiting for SQL replications ;)

Cheers
Andrew
0
 
LVL 18

Author Comment

by:Andrew Davis
ID: 39194627
Yep Group works as well.

Any idea where i am likely to find a complete table with explanations?

Cheers
0
 
LVL 18

Author Closing Comment

by:Andrew Davis
ID: 39194630
Good fun was had by all.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question