Posts Tagged ‘backup’

The following is a list of MySQL useful commands.

# To setup root password (first execution)
mysqladmin -u root password 'new_password'

# To login to MySQL
mysql -u root -p

# To create a database
create database dbname;

# To change database
use dbname;

# To create a user and assign to it permission to database
# Grant permission only from localhost connections
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

# Grant permission on all connections
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

# Manage MySQL export
# Copy all db1 content to /backup-db/db1 folder
mysqlhotcopy db1 /backup-db/db1

# Create a DB dump to a file
mysqldump db1 > db1_dump_db.sql -u root -p

Hope this help

Bye
Riccardo

Print This Post Print This Post

I’m using this script in a lot of Linux Server, especially some file server with a little ERP software written in COBOL with all files in /home/erp.
I’m saving all /home and /etc to have a full backup for disaster recovery purpose.

This scrit will do the following :

- Define variables
- Define DATE
- Create a compress archive of /home and /etc
- Rewind the TAPE
- Write all the data on TAPE
- Verify the TAPE
- Eject the TAPE

Obviously all the output of the above operations will be redirected to a log file fr diagnostic purpose.

- Mail all logged operations to the Server admin

The only prerequisites for let all works is “mail” packages installed on your system and a local mail server configured for routing mail to your “Server Admin” email address, I’m using Postfix, but you coul’d use whatever you want (eg. QMail or EXIM).
Read the rest of this entry »

This post will show a backup script used to create copies for a server running Oracle 10.2, some application server like FourJS and JBoss and some custom application written in java.

The backup process is divided in some parts :
- Variable declaration and export
- Oracle export and compress
- Data folder export and compress
- Application Server export and compress
- Tape writing of all compress file
- Tape checking
- Mail logging

This post assume you have the following enviroments, if you have something different you should only change variable declaration and comment some lines to have this script works.

- Oracle SID : DB01
- Oracle main folder : /oracle/product/10.2/db_1
- Oracle user/password : system/system
- DATA main folder to backup : /data
- APPSERVER main Folder : /appsrv
- Main backup folder : /data/backup

- Tape device : /dev/st0
Read the rest of this entry »

I toke me a long time on getting this to work right because of a number
of things like the firewall in ESX 3 and what BE Linux agent to use..
so that is why I have made this webpage so you can save time on this
when you setup a new ESX 3 server and don’t have the time to fight with
this.

Remote Agent for Linux and UNIX Servers (RALUS) 10.x

First the RALUS 10.x does not work on ESX because it can not see the
VMFS file system and Veritas will not fix this before next version
because it do not understand “links” in the file system.. so don’t use
time on.

you can see this Veritas
href=”http://support.veritas.com/docs/278671″>KB
id=”DOCUMENT_ID”>278671 about it and
her is what they write

Symantec
Corporation has acknowledged that the issue is present in the current
version(s) of the product(s),
There are no plans to address this issue by way of
a patch or hotfix in the current or previous versions of the software
at the present time. However, the issue is currently
scheduled to be addressed in the next major revision of the product.

Backup Exec UNIX Agent 5.0 revision 5.046

This is the Linux agent to use as it works and it can be download on
this Veritas
href=”http://support.veritas.com/docs/262592″>KB262592
or if you have Backup Exec 9.1 installed on your Windows server then is
found in a subfolder of the app.

Backup Exec on remote Windows server

This howto and the “Backup Exec UNIX Agent 5.0 revision 5.046″ is
working with Backup Exec 9.1, 10.x and 10D for Windows
Here is how to install it on the VMware ESX 3.0 and setup
Backup Exec for Windows

1. Download the linux agent software to a folder on the ESX 3.0 server

2. Login as Root on the ESX server

3. Change to folder and verify the TAR file is there

[root@ESX3
backupexec]# tar -xvf be_agent_91_for_linux.tar

BE_IDENTINSTALL

common/

common/init.d.agentcommon/sp.plist

common/VERSION

common/agent.aix

common/aix.excl

common/agent.hpux

common/hpux.excl

common/agent.linux

common/linux.excl

common/agent.linux24

common/linux24.excl

common/agent.sol_x86

common/sol_x86.excl

common/agent.solaris

common/solaris.excl

common/agent.uware7

common/uware7.excl

english/

english/SETUP

english/CONFIG

english/agent.cfg

5. Starting the Installation

[root@ESX3
tbj]# ./INSTALL
Backup Exec Unix Agent Language Selection v4.3Backup Exec UNIX Agent Install v3.7Copyright 2001 VERITAS Software Corporation. All Rights
Reserved.

6. Select OS as Linux 2.4 (number 5)

Operating
systems supported:
1. Solaris Sparc 2.6, 2.7, 8, 92. Solaris Intel x86 2.6, 7, 83. HP UX 10.20, 11.x4. IBM AIX 4.3.x, 5.x5. Linux 2.4 (RedHat7.1+, SuSE7.1+, Caldera3.1+, Turbo7.0+,
Mandrake8.0+)6. Linux 2.2, 2.0 (RedHat7.0-, SuSE7.1-, Caldera2.4-, Turbo6.5-,
Mandrake7.2-)

7. SCO UnixWare 7.x

Operating system detected:

Linux
2.4 (RedHat7.1+, SuSE7.1+, Caldera3.1+, Turbo7.0+, Mandrake8.0+)

Is
this correct? (y/n)

lang=”da”> y

Operating
system selected:

Linux
2.4 (RedHat7.1+, SuSE7.1+, Caldera3.1+, Turbo7.0+, Mandrake8.0+)

Installing
the Backup Exec UNIX Agent for system type: linux24

7. Type Y to install in the default folder

Please
enter the full directory path where the Backup Exec Agent should
be
installed: [/etc/bkupexec]
/etc/bkupexec
does not exist. Should this directory be created? (y/n)

xml:lang=”da” lang=”da”>y

8. Hit Enter to continue

Your
system’s initialization procedure has been modified to
automatically
start the Agent the next time your system is started.
Adding
the following line to /etc/services:
grfs
6101/tcp
# Backup Exec AgentAll
necessary Backup Exec Agent files have been copied to:
/etc/bkupexec
The
configuration for the Backup Exec Agent is stored in
/etc/bkupexec/agent.cfg.
You may edit this file at any time to change the configuration for the
Agent.

You
will now be prompted to enter the initial values for the Agent
configuration.

Press
Enter to continue

9. Type in the host and domain name of this ESX server

0+1
records in0+1 records out
Please
enter the name for this workstation [ESX3.company.tld]:

xml:lang=”da” lang=”da”> ESX3.company.tld

10. Select N (can be changed later if you like)


lang=”da”> Do you require a password for this workstation?
(y/n)
lang=”da”> n

11. No matter how many netcards you have select Y two times and enter
the IP number of the ESX COS IP

Does
this workstation have 2 or more network interfaces? (y/n)

xml:lang=”da” lang=”da”> y
Do you
want to specify which one to use? (y/n)

xml:lang=”da” lang=”da”> y
Enter
the IP address of the interface:

xml:lang=”da” lang=”da”>172.16.17.3

12. Select the / to be export and then wait with other paths as we type
them into the config file later!

Please
enter a directory path you want to export as a published path:

/
Please
enter a unique resource name for this published path: [root]

root
Do you
want to allow files to be restored to this published path? (y/n)

y
Do you
require a password for this published path? (y/n)

xml:lang=”da” lang=”da”> n
Do you
want to publish another directory path? (y/n)

n

13. Enter the IP number of the remote Backup Exec 9.1, 10.x or 10D
server that you like to backup this server.

You
must enter the names of the Backup Exec media servers which willaccess this workstation. The media server’s internet
addresses must bedefined in the /etc/hosts file or accessible via a naming service.
Please
enter a media server name:

xml:lang=”da” lang=”da”> 172.16.0.200
Locating
172.16.0.200….located and added to media server list.
Do you
want to add another media server? (y/n)

xml:lang=”da” lang=”da”>n

14. Enter 30 as the advertisement time, note that if you select another
value there is maybe a regkey on the windows server you need to change
also but Veritas write about it in the documentation.

The
Backup Exec Agent must periodically send advertisement messagesto the media servers to inform them that this workstation isaccessible. Please enter the frequency (in seconds) that these
advertisements
should be sent: [30]

lang=”da”> 30

15. Just select 1 and go on

Symbolic
links to directories may be backed up in one of two ways.
Method
1: The symbolically linked directory is handled as a special
file
and only the information required to recreate the symboliclink is backed up.Method
2: The symbolically linked directory is backed up as a normal
directory. All files and subdirectories within thesymbolically linked directory are also backed up.

Method
1 is preferred because it minimizes the amount of data which must

be backed up.

Which
method do you want to use? (1 or 2) [1]

xml:lang=”da” lang=”da”>1

16. Now the software is installed and pre config

Backup
Exec Agent configuration complete.
Note:
You may edit the file /etc/bkupexec/agent.cfg to change your Backup
Exec Agent configuration at any time. Configuration changes
for theBackup Exec Agent will take effect after the host is restarted. [root@ESX3
tbj]#

17. Goto the remote Backup Exec server and into the options, then
change the settings to be like this.

BEoption

18. Now on the ESX server again, Config the ESX firewall to allow
Backup exec Linux agent to talk with the remote backup exec server

[root@ESX3
backupexec]#esxcfg-firewall -o 6101,tcp,out,Backupexec[root@ESX3 backupexec]#esxcfg-firewall -o 6102,tcp,out,Backupexec[root@ESX3 backupexec]#

19. Config the ESX firewall to allow the remote Backup exec server to
talk with the agent on the ESX server.

#esxcfg-firewall -o 8192,tcp,in,Backupexec
#esxcfg-firewall -o 8193,tcp,in,Backupexec
#esxcfg-firewall -o 8194,tcp,in,Backupexec
#esxcfg-firewall -o 8195,tcp,in,Backupexec
#esxcfg-firewall -o 8196,tcp,in,Backupexec
#esxcfg-firewall -o 8197,tcp,in,Backupexec
#esxcfg-firewall -o 8198,tcp,in,Backupexec

20. Reload the firewall config

#esxcfg-firewall –load[root@ESX3 backupexec]#

21. open and edit the agent config file

# nano /etc/bkupexec/agent.cf

22. Change the config file to match your setup and write the file to
disk

# Set
the name to be the host and domain name of this ESX server

xml:lang=”da” lang=”da”>name ESX3.company.tld# Set this to be the IP number of ESX COSforce_address 172.16.17.3# To backup content from the VMFS volumes, then it is best to have this
setfollow_symdirs# This export the ESX OS so it can be backup up

export / as ESX_OS

# This export the the VMFS file system, you can export down to VMFS
storage name lavel

# but i will not awise that because if you change the name some day it
will crash the backup

# agent and you have to reconfig the agent every time..

# I found this to work best and on all server without isues

export /vmfs/volumes/ as VMFS_volumes include_remote

# This is to tell the remote backup servers about the agent, just
change the ip numbers to be

# the ip number of the remote backup exec server.

# for safty you can tell more then one server about the agent and i
allways do this as if one

# backup server brack down, you can just use the other server to backup
the ESX

# server until you have fix it

tell 172.16.0.200

tell 172.16.0.201

# This interval is default 30 and if you change this to some else, then
be sure to read the

# Backup exec manual as there in some case also need to change a regkey
on the

# remote backup server

tell_interval 30

# This is folder not to export to the remote backup server..

# I found this list to work well on the ESX 3.0 server

exclude_dir /dev

exclude_dir /proc

exclude_dir /tmp

exclude_dir /var/run/vmware

21. Restart the Backup Exec agent so it read the new config

[root@ESX3
backupexec]# /etc/init.d/agent.init stop[root@ESX3 backupexec]# /etc/init.d/agent.init start
Backup Exec — Unix Agent, Version 5.01 Revision 5.046Copyright 2001 VERITAS Software Corporation. All Rights
Reserved.[root@ESX3 backupexec]#

22. Now go to the remote backup server and make a test backup job where
you select some folders to backup with a lot of data so you can see
that it is stabile.

job

23. Monitor it is backup the file and the speed is what you expect it
to be, I have a LTO3 autoloader and the network is 1gbit and I can see
the network traffic is around 250mbit between the server so that is
just fine.

backup

24. Now monitor the verify, note the high speed is because it just
verifying checksums and there for fast, the network is also note
showing any trafic at all.

verifyNow Backup exec Linux agent is installed on the ESX 3.0 server
and works well

Today I had to install an ArcServer Unix agent on a brand new Linux system, and as any times i can’t find an init script that allow to start/stop/restart or see the agent status.

Google wasn’t my friend because I was without internet access so I’ve decided to write it by myself.

follow the Linux Init Script for ArcServe Unix Agent :

#! /bin/sh
#
# Author: Riccardo Riva
#

# System startup script for the inet daemon
#
### BEGIN INIT INFO
# Provides: uagent
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Start UAgent daemon.
### END INIT INFO

if [ -e /etc/rc.config ]; then
. /etc/rc.config
fi

if [ -e /etc/rc.status ]; then
. /etc/rc.status
fi

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

uagent_bin=/opt/uagent/uagent
return=$rc_done

# Reset status of this service.
rc_reset

# See how we were called.
case “$1″ in
start)
echo -n “Starting Uagent daemon: ”
$uagent_bin start || return=$rc_failed
echo -e “$return”
;;
stop)
echo -n “Stopping UAgent daemon: ”
$uagent_bin stop
sleep 2
$uagent_bin stop || return=$rc_failed
echo -e “$return”
sleep 2
;;
restart)
echo -n “Stopping UAgent daemon: ”
$uagent_bin stop
sleep 2
$uagent_bin stop || return=$rc_failed
echo -e “$return”
sleep 2
echo -n “Starting Uagent daemon: ”
$uagent_bin start || return=$rc_failed
echo -e “$return”
;;
status)
echo -n “Checking for UAgent daemon: ”
$uagent_bin status && echo OK || echo No process
;;
*)
echo “Usage: $0 {start|stop|status}”
exit 1
esac

test “$return” = “$rc_done” || exit 1
exit 0

Print This Post Print This Post

Contacts
Look at me at Linkedin Follow me on Twitter
My Flickr Albums My Facebook profile My YouTube Videos
SkypeMe My Linux Counter GMail me
Search
Google Search
Categories
Tag Cloud 3D
FeedBurner RSS

Visitors
Locations of visitors to this page
VMware related Blogs
The following are Blog sites with feeds I personally follow. When I'll have some spare time I will complete all Feed and Twitter links.