当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 1 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 第 37 章 csync2
帖子发表于 : 2008-10-31 21:23 

注册: 2008-10-09 21:41
帖子: 23
地址: 深圳
送出感谢: 0 次
接收感谢: 0 次
Netkiller Linux 手札
Debian/Ubuntu Cookbook
Neo Chan



中国广东省深圳市宝安区龙华镇
518109
+86 755 29812080
+86 755 29812080
<openunix@163.com>
文档出处
http://netkiller.8800.org/
http://netkiller.hikz.com/
http://netkiller.mefound.com

版权 © 2006, 2007, 2008 Netkiller(Neo Chan). All rights reserved.

版权声明

你可以任意转载,转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

文档最近一次更新于 Fri Oct 31 13:07:29 UTC 2008

对初学Linux的爱好者忠告

玩Linux最忌reboot(重新启动)这是windows玩家坏习惯

Linux 只要接上电源你就不要再想用reboot,shutdown,halt,poweroff命令,Linux系统和应用软件一般备有 reload,reconfigure,restart/start/stop...不需要安装软件或配置服务器后使用reboot重新引导计算机

在 Linux系统里SIGHUP信号被定义为刷新配置文件,有些程序没有提供reload参数,你可以给进程发送HUP信号,让它刷新配置文件,而不用 restart.通过pkill,killall,kill 都可以发送HUP信号例如: pkill -HUP httpd



第 37 章 csync2

目录

server
node
test
Advanced Configuration

homepage: http://oss.linbit.com/
server

过程 37.1. Install and setup csync2 on Ubuntu

1.

installation

$ sudo apt-get install csync2 sqlite3 openssl xinetd


The following line will be added to your /etc/inetd.conf file:

$ cat /etc/inetd.conf
csync2 stream tcp nowait root /usr/sbin/csync2 csync2 -i


If you are indeed using xinetd, you will have to convert the above into /etc/xinetd.conf format, and add it manually.

service csync2
{
disable = no
protocol = tcp
socket_type = stream
wait = no
user = root
server = /usr/sbin/csync2
server_args = -i
}


/etc/services

$ cat /etc/services |grep csync2
csync2 30865/tcp # cluster synchronization tool


2.

create a self-signed SSL certificate for csync2

sudo openssl genrsa -out /etc/csync2_ssl_key.pem 1024
sudo openssl req -new -key /etc/csync2_ssl_key.pem -out /etc/csync2_ssl_cert.csr
sudo openssl x509 -req -days 600 -in /etc/csync2_ssl_cert.csr -signkey /etc/csync2_ssl_key.pem -out /etc/csync2_ssl_cert.pem


$ sudo csync2 -k /etc/csync2_ssl_cert.key


3.

After having done everything, we are now going to configure Csync2 so that we can determine which files are going to be synchronized.

For this example, we are going to synchronize /etc/apache2 and /etc/mysql. For that we open /etc/csync2.cfg and we configure it like this:

$ sudo vim /etc/csync2.cfg
# please see the REAMDE file how to configure csync2

group testing #group name, we can have multiple groups
{
host master; #master server
host (slave); #slave server
#host (node1);

key /etc/csync2_ssl_cert.key;

include /etc/apache2/;
include /home/neo;

backup-directory /var/backups/csync2;
backup-generations 3;
auto none; #no automatic sync
}


4.

hosts

$ sudo vim /etc/hosts
192.168.245.131 slave


5.

restart

$ sudo /etc/init.d/xinetd restart


node

过程 37.2. node

1.

login to slave node

neo@slave:~$ sudo vim /etc/hosts
192.168.245.129 master


2.

install

$ sudo apt-get install csync2 xinetd


3.

copy config file from master

neo@slave:~$ sudo scp root@master:/etc/csync2* /etc/


4.

restart

neo@slave:~$ sudo /etc/init.d/xinetd restart


test

过程 37.3. testing

1.

master

neo@master:/etc/apache2$ sudo touch test.master
neo@master:/etc/apache2$ sudo csync2 -x


2.

node

neo@slave:/etc/apache2$ ls test.master -l
-rw-r--r-- 1 root root 0 2008-10-31 06:37 test.master


Advanced Configuration

例 37.1. /etc/csync2.cfg

$ sudo cat /etc/csync2.cfg

# please see the REAMDE file how to configure csync2
# group name, we can have multiple groups

group www {
host master;
host (slave);

key /etc/csync2_ssl_cert.key;

include /etc/apache2/;
include /etc/csync2.cfg;
include /var/www;
include %homedir%/neo;
exclude %homedir%/neo/temp;
exclude *~ .*;

action
{
pattern /etc/apache2/httpd.conf;
pattern /etc/apache2/sites-available/*;
exec "/usr/sbin/apache2ctl graceful";
logfile "/var/log/csync2_action.log";
do-local;
}

backup-directory /var/backups/csync2;
backup-generations 3;
auto none;
}

prefix homedir
{
on *: /home;
}


-----------------------------------------------------------------------------

目录

自述

本文目的
内容简介
读者对象
写给读者
作者简介
联系作者

1. Introduction

Linux Installation

I. System

2. device information
3. System Information
4. time zone

to change system date/time

5. Command

nohup - run a command immune to hangups, with output to a non-tty

6. Packages

Debian / Ubuntu apt-get

Update
Search
Installation
Remove
List of installed software packages

tar - GNU tar / compress and decompress

tar examples
gzip
b2zip

Zip

7. console / terminal

serial console
console timeout
disable x window

8. Disk

show partition
Create Partition
Format Partition

ext3
ReiserFS

II. Network

9. network tools

wget / axel
ncftp
curl / w3m / lynx
nmap
tcpdump
rdesktop - A Remote Desktop Protocol client

10. ethernet

Interfaces
Mask
Gateway
sysctl
bonding

Ubuntu

11. DNS/Bind

bind9
Load Balancing
view
tools

12. Proxy Server

Socks 5
Apache Proxy

13. Squid - Internet Object Cache (WWW proxy cache)

debian/ubuntu 安装
Proxy Server
Squid作为反向代理Cache服务器(Reverse Proxy)
代理+反向代理
Squid 管理
禁止页面被Cache
Squid 实用案例

Squid Apache/Lighttpd 在同一台服务器上
用非 root 用户守护 Squid

14. News Group (innd)

User Authentication

15. NET SNMP (Simple Network Management Protocol)

安装SNMP
例出MBI
Cacti

16. Ftp Server

ProFTPD + MySQL / OpenLDAP 用户认证

Proftpd + MySQL
Proftpd + OpenLDAP

Pure-FTPd + LDAP + MySQL + PGSQL + Virtual-Users + Quota

III. Security

17. OpenSSH

maximum number of authentication
disable root SSH login
Automatic SSH / SSH without password
Putty
OpenSSH Tunnel

18. ip tunnel

ipv4

19. OpenVPN

Ubuntu/Debian 环境安装
OpenVPN GUI for Windows
源码安装

20. Firewall

ulogd - The Netfilter Userspace Logging Daemon
ufw - program for managing a netfilter firewall
Firewall GUI Tools
Shorewall Tools

21. FreeRADIUS

ldap
mysql
WAP2 Enterprise

22. Kerberos

安装
生成kerberos的本地数据库

23. Email

IV. Web Application

24. Lighttpd and fastcgi

quick install with aptitude

php fastcgi

to compile and then install lighttpd

compress module
shell script

PHP

php fastcgi

Python
Perl

Installing lighttpd and FastCGI for Catalyst

25. LAMP

Compile and then install Apache

Apache 安装与配置
PHP

Quick install apache with aptitude

command
rewrite module
PHP module
deflate module
ssl module
VirtualHost
~userdir module - /public_html

XAMPP for Linux
PHP 5
Mod Perl

26. Tomcat 安装与配置

tomcat
mod_jk
mod_proxy_ajp
RewriteEngine 连接 Tomcat
Testing file
Shell Script

27. Application Service

Zope
JBoss - JBoss Enterprise Middleware

28. Web Server Optimization

ulimit
Apache 调优

worker

Tomcat
deflate

测试 gzip,deflate 模块

Apache Log
跟踪用户的cookie
Zend Optimizer
eaccelerator
khttpd

29. Web Analysis

综合测试
awstats
webalizer

V. Database

30. PostgreSQL

Install
Postgres 配置
PostgreSQL 实用实例参考

31. MySQL

Installation
Replication

Master
Slave
Testing

MySQL CLuster

Management node (MGM node)
Data node
SQL node
Starting
Shutdown
Testing

32. SQL

SQL 99
SQL 92

33. database design

opensource database design tools

VI. Storage And Backup/Restore

34. Samba

install
config
test

35. rsync - fast remote file copy program (like rcp)

install with source
install with aptitude
upload
download
mirror
rsync examples

36. tsync
37. csync2

server
node
test
Advanced Configuration

38. Unison File Synchronizer

local
remote
config

39. Network Storage - Openfiler

Accounts
Volumes

RAID
iSCSI

Quota
Shares

40. Amanda: Open Source Backup
41. inotify

inotify-tools
Incron - cron-like daemon which handles filesystem events

42. Distributed Filesystem

DRBD (Distributed Replicated Block Device)

disk and partition
Installation
configure
Starting
Using

Coda

VII. Cluster

44. Linux Virtual Server

环境配置
VS/NAT
VS/TUN
VS/DR

配置文件

ipvsadm script
debug

45. keepalived

安装
test

46. heartbeat+ldirectord

VIII. Developer

47. Editor

VIM

48. compiler

gcc - The GNU C compiler
g++ - The GNU C++ compiler
make
调试工具

ldd

49. PHP 5

pear - Packages
PHPUnit - Unit testing framework for PHP
PHP connect SQL Server under unix like

50. Python

Django
Python Imaging Library

51. Perl

Catalyst Web framework
Module::Build
ExtUtils::MakeMaker
Test::Simple
Test::More

52. Java
53. Project

Subversion

svn
inetd.conf / xinetd.d
WebDav

TRAC
TUTOS

54. Memcached

python-memcached
Java API
PHP Memcache

55. Command Shell

find and replace
to convert utf-8 from gb2312 code
php function check

56. OpenLDAP server (slapd)

Installation
基本操作

Add
Search
Modify
Delete
Search

Active Directory
Replication

Primary
Secondary

Backup and Restore

57. Assistant

Webmin
logwatch
awstats
webalizer
Cacti
nulog
Zenoss
Nagios
BIG BROTHER
Ganglia

58. Open Source Distributed Computing

Boinc (berkeley 分布式计算平台)

59. Multimedia

ImageMagick
How to add metadata to digital pictures from the command line
broadcast streaming

gnump3d - A streaming server for MP3 and OGG files
icecast2 - Ogg Vorbis and MP3 streaming media server
shoutcast
PeerCast

60. Voice over IP

Gnu Gatekeeper

Gnu Gatekeeper Install
Gnu Gatekeeper Configure
Gnu Gatekeeper Test

Asterisk (OpenSource Linux PBX that supports both SIP and H.323)
OpenSER SIP Server

61. 案例

大型网站架设指南
基于LVS的集群邮件系统

62. 历史记录
A. 附录


_________________
http://netkiller.8800.org


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 1 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 3 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译