понедельник, 6 апреля 2009 г.

Правим UDEV для DV камеры

В файле /lib/udev/rules.d/50-udev-default.rules

Правим:
# KERNEL=="dv1394[0-9]*", NAME="dv1394/%n", GROUP="video"
KERNEL=="video1394[0-9]*", NAME="video1394/%n", GROUP="video"
KERNEL=="dv1394*", GROUP="video"
KERNEL=="raw1394", GROUP="plugdev"

среда, 1 апреля 2009 г.

Установка bacula

Журнал, backup сервер, установка и настройка
hostname нашего сервера: at0038

У меня контроллер на 8 дисков, по 500 гБ каждый
Делаем два RAID массива, system - 60 GB, data - 2700 GB
Это необходимо, из-за того, что CentOS не может установиться на раздел больше чем 2 ТБ.
sda1 - 10 gb / (корневой раздел оставляем не на ЛВМ)
sda2 - 50 gb pv
sdb1 - 2,6 tb pv
vg0 - /dev/sda2 (Один волумгруп для системных разделов)
vg1 - /dev/sdb1 (один волум групп для данных)
vg0/lv_swap - 2 gb - swap
vg0/lv_var - 10 gb - /var
vg0/lv_tmp - 10 gb - /tmp
vg0/lv_usr - 10 gb - /usr
vg1/lv_bacula - 2,6 tb - /bacula

Centos 5.2 - Установка поумолчанию.
Обновляемся после установки.

Качаем свежую сборку bacula rpms-contrib-fschwarz
Устанавливаем:
качаем ключ: wget http://freefr.dl.sourceforge.net/sourceforge/bacula/fschwarz.asc
устанавливаем ключ: rpm --import fschwarz.asc
yum --nogpgcheck install bacula-mysql-2.4.2-1.el5.i386.rpm bacula-bat-2.4.2-1.el5.i386.rpm bacula-gconsole-2.4.2-1.el5.i386.rpm
правим /etc/aliases:
root: тут адрес на который должны приходить инормационные письма
# newaliases
# /etc/init.d/sendmail restart
Настройка Bacula

Читать:
http://www.opennet.ru/soft/Short_Doc_Bacula.pdf
http://santa-claus-rpm.livejournal.com/5066.html
http://www.opennet.ru/soft/Bacula_PDC_backup.pdf
http://wiki.bacula.org/doku.php
http://www.bog.pp.ru/work/bacula.html

В папке /bacula/devices - создаю папки для каждого клиента, каждая папка устройство (device), бакула не может писать два задания на одно устройство одновременно, если хотим чтобы копирование происходило с нескольких клиентов одновременно, тогда нужно создать несколько устройств.

Конфигурационные файлы:

bacula-dir.conf:

Director {
Name = at0038-dir
DIRport = 9101
QueryFile = "/usr/lib/bacula/query.sql"
WorkingDirectory = "/var/lib/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 10
Password = "12345"
Messages = Daemon
}

Console {
Name = at0038-mon
Password = "12345"
CommandACL = status, .status
}

# Generic catalog service
Catalog {
Name = MyCatalog
dbname = "bacula"; dbuser = "bacula"; dbpassword = ""
}

JobDefs {
Name = "DefaultJob"
Maximum Concurrent Jobs = 20
Type = Backup
Level = Incremental
Schedule = "WeeklyCycle"
Messages = Standard
Pool = Default
Priority = 10

}

Job {
Name = "RestoreFiles"
Type = Restore
Client= at0038-fd
FileSet="at0038-FileSet"
Storage = FileStorage
Pool = Default
Messages = Standard
Where = /bacula/restores
Priority = 11
Maximum Concurrent Jobs = 100
}

Schedule {
Name = "WeeklyCycle"
Run = FullPool=fullbackup-pool Level=Full Pool=fullbackup-pool 1st fri at 23:05
Run = DifferentialPool=diffbackup-pool Level=Differential Pool=diffbackup-pool 2nd-5th fri at 23:05
Run = IncrementalPool=incbackup-pool Level=Incremental Pool=incbackup-pool sat,sun,mon,tue,wed,thu at 23:05
}

Schedule {
Name = "WeeklyCycleAfterBackup"
Run = Full sun-sat at 23:10
}

Storage {
Name = FileStorage
Maximum Concurrent Jobs = 1
Address = at0038
SDPort = 9103
Password = "12345"
Device = FileStorage
Media Type = File
}


Messages {
Name = Standard
operatorcommand = "/usr/sbin/bsmtp -h localhost -f bacula@at0038 -s \"Bacula: Intervention needed for %j\" %r"
mailcommand = "/usr/sbin/bsmtp -8 -h localhost -f bacula@at0038 -s \"%c %n %l %t: %e\" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = "/var/lib/bacula/log" = all, !skipped
}

Messages {
Name = Daemon
mailcommand = "/usr/sbin/bsmtp -h localhost -f bacula@at0038 -s \"Bacula daemon message\" %r"
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = "/var/lib/bacula/log" = all, !skipped
}

Pool {
Name = Default
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
Label Format = "default-${Job}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}"
}

Pool {
Name = Scratch
Pool Type = Backup
}

Pool {
Name = fullbackup-pool
Pool Type = Backup
Volume Retention = 200 days
AutoPrune = yes
RecyclePool = Scratch
Recycle = yes
Recycle Oldest Volume = yes
Label Format = "fullbackup-${Job}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}${Second:p/2/0/r}"
Use Volume Once = Yes
}

Pool {
Name = diffbackup-pool
Pool Type = Backup
Volume Retention = 40 days
AutoPrune = yes
RecyclePool = Scratch
Recycle = yes
Recycle Oldest Volume = yes
Label Format = "diffbackup-${Job}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}${Second:p/2/0/r}"
Use Volume Once = Yes
}

Pool {
Name = incbackup-pool
Pool Type = Backup
Volume Use Duration = 7 days
Volume Retention = 8 days
AutoPrune = yes
RecyclePool = Scratch
Recycle = yes
Recycle Oldest Volume = yes
Label Format = "incbackup-${Job}-${Year}${Month:p/2/0/r}${Day:p/2/0/r}-${Hour:p/2/0/r}${Minute:p/2/0/r}${Second:p/2/0/r}"
Use Volume Once = Yes
}

@/etc/bacula/conf.d/шаблон для каждого клиента компьютера (имякомпьютера-dir.conf)

bacula-sd.conf:

Storage { # definition of myself
Name = at0038-sd
SDPort = 9103
WorkingDirectory = "/var/lib/bacula"
Pid Directory = "/var/run"
Maximum Concurrent Jobs = 20
}

Director {
Name = at0038-dir
Password = "12345"
}

Director {
Name = at0038-mon
Password = "12345"
Monitor = yes
}

Device {
Name = FileStorage
Media Type = File
Archive Device = /bacula/devices/default
LabelMedia = yes
Random Access = Yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
}

Messages {
Name = Standard
director = at0038-dir = all
}

@/etc/bacula/conf.d/шаблон для каждого клиента компьютера (имякомпьютера-sd.conf)

bacula-fd.conf:

Director {
Name = at0038-dir
Password = "12345"
}

Director {
Name = at0038-mon
Password = "12345"
Monitor = yes
}

FileDaemon { # this is me
Name = at0038-fd
FDport = 9102 # where we listen for the director
# WorkingDirectory = "C:\\Documents and Settings\\All Users\\Application Data\\Bacula\\Work"
# Pid Directory = "C:\\Documents and Settings\\All Users\\Application Data\\Bacula\\Work"
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}

Messages {
Name = Standard
director = at0038-dir = all, !skipped, !restored
}

bat.conf, bconsole.conf

Director {
Name = at0038-dir
DIRport = 9101
address = at0038
Password = "12345"
}

шаблон-dir.conf:

# %wintemplate% dir
# Client (File Services) to backup
Job {
Name = "%wintemplate%-job"
Maximum Concurrent Jobs = 10
JobDefs = "DefaultJob"
Write Bootstrap = "/var/lib/bacula/%wintemplate%.bsr"
Client = %wintemplate%-fd
FileSet = "%wintemplate%-FileSet"
Storage = "%wintemplate%-FileStorage"
ClientRunBeforeJob = "\"C:\\Documents and Settings\\All Users\\Application Data\\Bacula\\runbefore.bat\""
ClientRunAfterJob = "\"C:\\Documents and Settings\\All Users\\Application Data\\Bacula\\runafter.bat\""
}

Client {
Name = %wintemplate%-fd
Maximum Concurrent Jobs = 10
Address = %wintemplate%
FDPort = 9102
Catalog = MyCatalog
Password = "12345" # password for FileDaemon
File Retention = 60 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}

# List of files to be backed up
FileSet {
Name = "%wintemplate%-FileSet"
Enable VSS = yes
Include {
Options {
signature = MD5
compression = GZIP
IgnoreCase = yes
Exclude = yes
WildDir = "[A-Z]:/temp"
WildFile = "*.tmp"
WildDir = "[A-Z]:/RECYCLER"
WildFile = "[A-Z]:/pagefile.sys"
WildFile = "*.mp1"
WildFile = "*.mp2"
WildFile = "*.mp3"
WildFile = "*.avi"
WildFile = "*.mpg"
WildFile = "*.mpeg"
WildFile = "*.ogg"
WildFile = "*.cdx"
}
File = C:/SystemStateBackup.bkf
}
Exclude {
}
}

# Definition of file storage device
Storage {
Name = %wintemplate%-FileStorage
Maximum Concurrent Jobs = 10
Address = at0038
SDPort = 9103
Password = "12345"
Device = %wintemplate%-FileStorage
Media Type = %wintemplate%-File
}

шаблон-dir.conf (linux):

# %nixtemplate% dir
# Client (File Services) to backup
Job {
Name = "%nixtmplate%-job"
Maximum Concurrent Jobs = 10
JobDefs = "DefaultJob"
Write Bootstrap = "/var/lib/bacula/at0038.bsr"
Client = at0038-fd
FileSet = "%nixtmplate%-FileSet"
Storage = %nixtmplate%-FileStorage
}

Client {
Name = %nixtmplate%-fd
Maximum Concurrent Jobs = 10
Address = %nixtmplate%
FDPort = 9102
Catalog = MyCatalog
Password = "12345" # password for FileDaemon
File Retention = 60 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}

# List of files to be backed up
FileSet {
Name = "%nixtmplate%-FileSet"
Include {
Options {
signature = MD5
compression = GZIP
}
File = /home
File = /etc
File = /usr/local
File = /opt
File = /root
File = /var/log
File = /var/run
File = /var/spool
}

Exclude {
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}

# Definition of file storage device
Storage {
Name = %nixtmplate%-FileStorage
Maximum Concurrent Jobs = 10
Address = at0038
SDPort = 9103
Password = "12345"
Device = %nixtmplate%-FileStorage
Media Type = %nixtmplate%-File
}

шаблон-sd:

Device {
Name = %template%-FileStorage
Device Type = File
Media Type = %template%-File
Archive Device = /bacula/devices/%template%
Random Access = Yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
LabelMedia = yes
}