Solved

lsyncd rsync web servers.

Posted on 2013-05-24
11
2,300 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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