Instalacao do amanda - mq testa

atualizando - server
- descompactar o pacote
- gerar o configure
  ./configure --with-low-tcpportrange=850,859 --with-udpportrange=850,859 --with-gnutar=/bin/tar --with-user=root --with-group=root
- make
- make install
- restartar o xinetd
  - /etc/init.d/xinetd restart

atualizando o client (mq de onde sera feito o backup)
- descompactar o pacote
- gerar o configure com a opcao --without-server
  ./configure --with-low-tcpportrange=850,859 --with-udpportrange=850,859 --with-gnutar=/bin/tar --with-user=root --with-group=root --without-server
- make
- make install
- restartar o servico xinetd
  /etc/init.d/xinetd restart


instalacao do server (mq onde sera feito o backup)
pegar o fonte em:
- http://www.amanda.org
  no nosso caso a versao e 2.4.5 (20051003)
- descompactar o pacote
  - tar zxvf amanda-2.4.5.tar.gz
- cd amanda-2.4.5
- gerar o configure
  ./configure --with-low-tcpportrange=850,859 --with-udpportrange=850,859 --with-gnutar=/bin/tar --with-user=root --with-group=root
- make
- make install
- adicionar no /etc/services as portas para o amanda
  amanda          10080/tcp                       # amanda backup  services
  amanda          10080/udp                       # amanda backup services
  amandaidx       10082/tcp
- adicionar a permissao de autenticacao em /root/.amandahosts
  servidor.dominio.com.br
- descobrir o tapetype
  - amtapetype -f /dev/nst1 ou 0
    esta informacao devera ser colocada no item 
    "define tapetype DAT {..." do amanda.conf
- adicionar o servidor de fitas e indices no /etc/xinetd.d
  - vi amandaidx e colocar o conteudo abaixo
    service amandaidx 
    {
			socket_type     = stream
			wait            = no
			user            = root
			server          = /usr/local/libexec/amindexd
			log_on_success  += HOST DURATION
			log_on_failure  += HOST
			disable         = no
	 }
  - vi amidxtape e colocar o conteudo abaixo
    service amidxtape
	 {
		    socket_type     = stream
			  wait            = no
			user            = root
			server          = /usr/local/libexec/amidxtaped
			log_on_success  += HOST DURATION
			log_on_failure  += HOST
			disable         = no
	 }
- restartar o xinetd
  - /etc/init.d/xinetd restart
- criar os arquivos abaixo
  - touch /etc/amandates
  - touch /etc/dumpdates
- criar o diretorio de holding
  - mkdir /amanda
- personalizar o arquivo de configuração
  - cd /usr/local/etc/amanda/01servidor, por exemplo.
org "SERVIDOR 01"
mailto "user@provedor.com.br"
dumpuser "root"

inparallel 2

dumporder "STB"

netusage 4000 Kbps

dumpcycle 14
runspercycle 2 

tapecycle 10 tapes

bumpsize 20 Mb
bumpdays 1 
bumpmult 4

etimeout 300
ctimeout 30
dtimeout 1800

tapebufs 30

tapetype DDS3
labelstr "^01servidor[0-9][0-9]*$"

amrecover_do_fsf yes
amrecover_check_label yes


holdingdisk hd1 {
    comment "main holding disk"
    directory "/amanda"  
    use 1500 Mb         
    chunksize 2Gb       
    }

autoflush yes

infofile "/var/log/amanda/servidor/curinfo"    # database DIRECTORY
logdir   "/var/log/amanda/servidor"            # log directory
indexdir "/var/log/amanda/servidor/index"      # index directory
tapelist "/var/log/amanda/servidor/tapelist"
#tapedev "/dev/st0"
tapedev "/dev/nst1"

define tapetype DAT {
    comment "DAT tape drives"
    length 4000 mbytes          # these numbers are not accurate
    filemark 100 kbytes         # but you get the idea
    speed 100 kbytes
}

define tapetype DDS3 {
    comment "just produced by tapetype prog (hardware compression on)"
    length 12288 mbytes
    filemark 65 kbytes
    speed 769 kps
}

define tapetype DDS2 {
        comment "just produced by tapetype prog (hardware compression on)"
        length 3239 mbytes
        filemark 0 kbytes
        speed  284 kps
}

define dumptype global {
        program "GNUTAR"
}

define dumptype always-full {
    global
    comment "Full dump of this filesystem always"
    compress none
    priority high
    dumpcycle 0
}

define dumptype root-tar {
    global
    program "GNUTAR"
    comment "root partitions dumped with tar"
    compress none
    index
#   exclude list "/usr/local/lib/amanda/exclude.gtar"
    priority low
}

define dumptype user-tar {
    root-tar
    comment "user partitions dumped with tar"
    priority medium
}

define dumptype high-tar {
    root-tar
    comment "partitions dumped with tar"
    priority high
}

define dumptype comp-root-tar {
    root-tar
    comment "Root partitions with compression"
    compress client fast
}

define dumptype comp-user-tar {
    user-tar
    compress client fast
}

define dumptype holding-disk {
    global
    comment "The master-host holding disk itself"
    holdingdisk no # do not use the holding disk
    priority medium
}

define dumptype comp-user {
    global
    comment "Non-root partitions on reasonably fast machines"
    compress client fast
    priority medium
}

define dumptype nocomp-user {
    comp-user
    comment "Non-root partitions on slow machines"
    compress none
}

define dumptype comp-root {
    global
    comment "Root partitions with compression"
    compress client fast
    priority low
}

define dumptype nocomp-root {
    comp-root
    comment "Root partitions without compression"
    compress none
}

define dumptype comp-high {
    global
    comment "very important partitions on fast machines"
    compress client best
    priority high
}

define dumptype nocomp-high {
    comp-high
    comment "very important partitions on slow machines"
    compress none
}

define dumptype nocomp-test {
    global
    comment "test dump without compression, no /etc/dumpdates recording"
    compress none
    record no
    priority medium
}

define dumptype comp-test {
    nocomp-test
    comment "test dump with compression, no /etc/dumpdates recording"
    compress client fast
}

define dumptype test {
    priority high
    program "GNUTAR"
    #strategy noinc
    comment "test dump user"
    index yes
    compress server best
    #compress client fast
}

define interface eth0 {
    comment "100 Mbps ethernet"
    use 4000 kbps
}

define interface lo {
    comment "localhost interface"
    use 4000 kbps
}

- personalizar o arquivo de definicao do que sera backpeado
  - vi disklist
    
servidor / {
	test
	include "./etc" "./root" "./boot" "./home" "./usr" "./var/log"
} lo

ou neste formato
#servidor /etc test lo
#servidor /home test lo
#servidor /root test lo

- adicionar no crontab uma linha para a execucao do backup
  - crontab -e
  - 45 00 * * 1-5 /usr/local/sbin/amdump 01servidor;mt -f /dev/nst1 rewoffl 2> /tmp/error.bakcup

instalacao do cliente (mq de onde sera feito o backup)
- descompactar o pacote
- gerar o configure com a opcao --without-server
  ./configure --with-low-tcpportrange=850,859 --with-udpportrange=850,859 --with-gnutar=/bin/tar --with-user=root --with-group=root --without-server
- make
- make install
- adicionar no /etc/services as portas para o amanda
  amanda          10080/tcp                       # amanda backup  services
  amanda          10080/udp                       # amanda backup services
  amandaidx       10082/tcp
- adicionar a definicao do servico amanda no xinetd
  vi /etc/xinetd.d/amanda
  service amanda
  {
        socket_type     = dgram
        wait            = yes
        user            = root
        protocol        = udp
        server          = /usr/local/libexec/amandad
        log_on_success  += HOST DURATION
        log_on_failure  += HOST
        disable         = no
        only_from       = IP da mq onde esta o server
        only_from      += IP (caso queira colocar mais de um IP)
        bind            = IP do servidor
  }
- restartar o servico xinetd
  /etc/init.d/xinetd restart
- editar o arquivo de hosts autorizados
  - cd /root
  - vi .amandahosts e inserir a linha 
    - servidor.dominio.com.br
- mudar permissao do .amandahosts
  - chmod 600 .amandahosts
- criar o arquivo /etc/amandates
  :>/etc/amandates
- criar o diretorio /usr/local/var/amanda/gnutar-lists
  mkdir -p /usr/local/var/amanda/gnutar-lists
- liberar as portas no firewall no server
#Entrada do amanda
iptables -A INPUT -s x.x.x.x/32 -p udp --sport 850:859 --dport 10080 -j ACCEPT
iptables -A INPUT -s x.x.x.x/32 -p tcp --sport 850:859 -j ACCEPT

#Saida do amanda
iptables -A OUTPUT -s x.x.x.x/32 -d x.x.x.x/32 -p udp --dport 850:859 --sport 10080 -j ACCEPT
iptables -A OUTPUT -s x.x.x.x/32 -d x.x.x.x/32 -p tcp --dport 850:859 -j ACCEPT

nomeando as fitas
- amlabel -f host nome_da_fita (test3 test301, por exemplo)
  -f = forca o label, ou seja, se a fita ja foi usada pelo amana e ja esta
       labelada, toca o foda-se para o label anterior e usa o que esta sendo
       solicitado. a mensagem de que ja existe um label anterior e:
       - rewinding, reading label cogeae301, tape is in another amanda 
         configuration rewinding
         tape not labeled

verificando a configuracao
- amcheck host

recuperando backup
- amrecover -C 01servidor -d /dev/nst0
  na interface
  - setdisk / / (este parametro esta no disklist)
  - agora ja e possivel navegar pelo disco virtual e escolher os arquivos
    desejados para recuperacao
  - cd 
  - add  ou  - para adicionar
  - extract - para extrair depois de escolhido os arquivos ou diretorios
  - sera perguntado onde se deseja extrair e em seguida sera solicitado que
    se monte a fita necessaria.

ou com restore (pra fita inteira)
- mt -f /dev/nst0 rewoffl
- amrestore -p /dev/nst0 servidor |tar -xvf  -
  vai criar a estrutura de diretorio a partir do local onde for
  executado o comando. 
  ATENCAO: Prestar atencao para que tenha espaco suficiente no FS
 
problemas estranhos
selfcheck request timed out.  Host down?
- rode /usr/local/libexec/amandad, no client
  se der:
  /usr/local/libexec/amandad: error while loading shared libraries:
  libamclient-2.4.5.so: cannot open shared object file: No such file or
  directory
- rode ldconfig

A TAPE ERROR OCCURRED: [reading label: Input/output error].
- edite /var/log/amanda//tapelist
  e retire a definicao para a fita que esta com problemas
  faca a mesma coisa para tapelist.amlabel e tapelist.yesterday
- rode amlabel  

lev 0 FAILED [Estimate timeout from
- aumentar o parametro "etimeout" do amanda.conf

amcheck: error while loading shared libraries: libamserver-2.5.1p1.so: cannot open shared object file: No such file or directory
- isso normalmente ocorre apos uma atualizacao
  - rodar ldconfig

ERROR: NAK servidor: user root from xxx.xxx.com.br is not allowed to execute the service noop: /root/.amandahosts: incorrect permissions; file must be accessible only by its owner
- mudar a porcaria da permissao, na mq client, do /root/.amandahosts para 600 :-(
PUCSP Home Page Núcleo de Computação Científica da PUCSP Marcio's Homepage
Valid HTML
			   4.01!
Valid CSS!
Free web hosting

Free web hostingWeb hosting