Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
joohanhong
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JooHan Hong
joohanhong
Commits
fc77e196
Commit
fc77e196
authored
Mar 04, 2023
by
JooHan Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system/db backup modify1
parent
1c5239d7
Pipeline
#7010
passed with stages
in 1 minute and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
254 additions
and
0 deletions
+254
-0
README.md
SYSTEM/BACKUP/README.md
+254
-0
No files found.
SYSTEM/BACKUP/README.md
View file @
fc77e196
...
@@ -9,6 +9,260 @@
...
@@ -9,6 +9,260 @@
# System 설정 백업
# System 설정 백업
먼저 시스템 백업은 Bash Script 기반으로 구성되어 있으며, 다음과 같이 구성되어 있다.
-
STEP 1 : Rsync (Netowkr)를 이용하여, 원격지의 설정 파일을 백업 받는다.
-
STEP 2 : 증분백업이 필요한 시스템의 경우 STEP 1이 완료되면, 내부적으로
`증분 백업(cp -al 링크 옵션)`
으로 진행한다.
또한 백업 스크립트의 경우도 다음과 같이 두 가지로 분기 처리된다.
-
백업정책 스크립트 :
`backup_hongsnet.sh`
-
백업 스크립트 :
`remotebackup_type2`
## 백업정책 스크립트
```
bash
#!/bin/sh
# Description: Backup Policy Script
# Author: juhanida21@nate.com
date
=
`
date
+
"%Y-%m-%d"
`
epath
=
"/usr/local/scripts/backup/hosting/backup/hongsnet/remotebackup_type2"
BACKUP
=
"BACKUP/hongsnet"
logdir
=
"/
$BACKUP
/log"
log
=
"
$logdir
/result_log-
$date
"
if
[
!
-d
/
$BACKUP
]
;
then
/bin/mkdir
-p
/
$BACKUP
echo
""
echo
"/
$BACKUP
Directory Create!"
echo
""
fi
if
[
!
-d
/
$BACKUP
/log
]
;
then
/bin/mkdir
-p
/
$BACKUP
/log
echo
""
echo
"/
$BACKUP
/log Directory Create!"
echo
""
fi
date_net
=
`
date
+
"%Y-%m-%d-%H:%M:%S"
`
echo
"###########################################################################"
>>
$log
echo
"
$date_net
NETWORK BACKUP (START)"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"Hongs Dev NETWORK BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
$epath
$BACKUP
etc 172.24.0.135 NOT NOT
>>
$log
$epath
$BACKUP
home 172.24.0.135 NOT NOT
>>
$log
$epath
$BACKUP
usrlocal 172.24.0.135 NOT NOT
>>
$log
$epath
$BACKUP
root 172.24.0.135 NOT NOT
>>
$log
echo
"###########################################################################"
>>
$log
echo
"Hongs Dev NETWORK BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
....중략
echo
"###########################################################################"
>>
$log
echo
"DBMS NETWORK BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
$epath
$BACKUP
etc 180.180.180.250 NOT NOT
>>
$log
$epath
$BACKUP
home 180.180.180.250 NOT NOT
>>
$log
$epath
$BACKUP
usrlocal 180.180.180.250 NOT NOT
>>
$log
$epath
$BACKUP
root 180.180.180.250 NOT NOT
>>
$log
echo
"###########################################################################"
>>
$log
echo
"DBMS NETWORK BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"TB3-K8S NETWORK BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
$epath
$BACKUP
etc 172.16.0.251 NOT NOT
>>
$log
$epath
$BACKUP
home 172.16.0.251 NOT NOT
>>
$log
$epath
$BACKUP
usrlocal 172.16.0.251 NOT NOT
>>
$log
$epath
$BACKUP
root 172.16.0.251 NOT NOT
>>
$log
echo
"###########################################################################"
>>
$log
echo
"TB3-K8S NETWORK BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"TB3 NETWORK BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
$epath
$BACKUP
etc 172.16.0.158 NOT NOT
>>
$log
$epath
$BACKUP
home 172.16.0.158 NOT NOT
>>
$log
$epath
$BACKUP
usrlocal 172.16.0.158 NOT NOT
>>
$log
$epath
$BACKUP
root 172.16.0.158 NOT NOT
>>
$log
echo
"###########################################################################"
>>
$log
echo
"TB3 NETWORK BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"TB2 NETWORK BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
$epath
$BACKUP
etc 172.24.0.151 NOT NOT
>>
$log
$epath
$BACKUP
home 172.24.0.151 NOT NOT
>>
$log
$epath
$BACKUP
usrlocal 172.24.0.151 NOT NOT
>>
$log
$epath
$BACKUP
root 172.24.0.151 NOT NOT
>>
$log
echo
"###########################################################################"
>>
$log
echo
"TB2 NETWORK BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
date_net_end
=
`
date
+
"%Y-%m-%d-%H:%M:%S"
`
echo
"###########################################################################"
>>
$log
echo
"
$date_net_end
NETWORK BACKUP (END)"
>>
$log
echo
"###########################################################################"
>>
$log
date_local
=
`
date
+
"%Y-%m-%d-%H:%M:%S"
`
echo
"###########################################################################"
>>
$log
echo
"
$date_local
LOCAL BACKUP (START)"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"Hongs Dev INC BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
$epath
$BACKUP
home 172.24.0.135 3 data_rotate
>>
$log
echo
"###########################################################################"
>>
$log
echo
"Hongs Dev INC BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"iHosting INC BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
$epath
$BACKUP
home 192.168.100.156 3 data_rotate
>>
$log
echo
"###########################################################################"
>>
$log
echo
"iHosting INC BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"###########################################################################"
>>
$log
echo
"1M BYTE UP FILE DELETE BACKUP START"
>>
$log
echo
"###########################################################################"
>>
$log
/usr/bin/find /
$BACKUP
/
-name
".*"
-size
+1000k
-exec
rm
-rfv
{}
\;
>>
$log
echo
"###########################################################################"
>>
$log
echo
"1M BYTE UP FILE DELETE BACKUP END"
>>
$log
echo
"###########################################################################"
>>
$log
date_local_end
=
`
date
+
"%Y-%m-%d-%H:%M:%S"
`
echo
"###########################################################################"
>>
$log
echo
"
$date_local_end
LOCAL BACKUP (END)"
>>
$log
echo
"###########################################################################"
>>
$log
```
> 설정될 모듈은 반드시 rsync 모듈명과 같아야 한다.
## 백업 스크립트
```
bash
#!/bin/sh
# Description: Hongsnet Backup Scripts
# Date : 2015-10-20
# Author : joohanhong <juhanida21@nate.com>
#date=`date +"%Y-%m-%d-%H"`
date
=
`
date
+
"%Y-%m-%d"
`
#echo $1
#echo $2
#echo $3
#echo $4
#echo $5
[
$#
-ne
5
]
&&
{
echo
echo
========================================================================================================================================================================
echo
echo
'USAGE : remotebackup_type2 PATH RSYNC_NAME IPADDR HOMEROTATE(DAY) ROTATE'
echo
echo
'e.g, remotebackup_type2 backup(/ not!) test 192.168.1.1 3 data_rotate(if no value is NOT)'
echo
echo
========================================================================================================================================================================
echo
exit
1
}
# Requirement Args 값이 NULL이 아닐경우에 시작
if
[
$1
!=
NULL
-a
$2
!=
NULL
-a
$3
!=
NULL
-a
$4
!=
NULL
-a
$5
!=
NULL
]
;
then
if
[
!
-d
/
$1
]
;
then
/bin/mkdir
-p
/
$1
echo
""
echo
"
$1
Directory Created!"
echo
""
fi
if
[
!
-d
/
$1
/
$3
]
;
then
/bin/mkdir
-p
/
$1
/
$3
echo
""
echo
"
$3
Directory Created!"
echo
""
fi
if
[
!
-d
/
$1
/
$3
/
$2
]
;
then
/bin/mkdir
-p
/
$1
/
$3
/
$2
echo
""
echo
"
$3
Directory /
$1
/
$3
/
$2
Created!"
echo
""
fi
if
[
$5
==
"NOT"
]
;
then
/usr/bin/rsync
-az
--timeout
=
600
$3
::
$2
/
$1
/
$3
/
$2
/
elif
[
$5
==
"data_rotate"
]
;
then
if
[
!
-d
/
$1
/
$3
/
${
2
}
_Rotate
]
;
then
/bin/mkdir
-p
/
$1
/
$3
/
${
2
}
_Rotate
echo
""
echo
"/
$1
/
$3
/
${
2
}
_Rotate Directory Create!"
echo
""
fi
number
=
$4
number2
=
$4
for
dirs
in
$(
cd
/
$1
/
$3
/
${
2
}
_Rotate
;
ls
|grep inc. |cut
-c5-6
)
do
if
[
"
$dirs
"
-gt
"
$number2
"
]
;
then
/bin/rm
-rf
/
$1
/
$3
/
${
2
}
_Rotate/inc.
$dirs
fi
done
echo
"#
$DATE2
: mv /
$1
/
$3
/
${
2
}
_Rotate/inc.
${
number2
}
/
$1
/
$3
/
${
2
}
_Rotate/inc.99"
/bin/mv /
$1
/
$3
/
${
2
}
_Rotate/inc.
${
number2
}
/
$1
/
$3
/
${
2
}
_Rotate/inc.99 2>/dev/null
while
[
$number
-gt
1
]
;
do
number2
=
$[
number - 1]
DATE2
=
$(
date
+%Y%m%d-%H:%m:%S
)
echo
"#
$DATE2
: mv /
$1
/
$3
/
${
2
}
_Rotate/inc.
${
number2
}
/
$1
/
$3
/
${
2
}
_Rotate/inc.
${
number
}
"
/bin/mv /
$1
/
$3
/
${
2
}
_Rotate/inc.
${
number2
}
/
$1
/
$3
/
${
2
}
_Rotate/inc.
${
number
}
2>/dev/null
sleep
1
number
=
$[
number - 1]
done
#inc.1
if
[
-d
/
$1
/
$3
/
${
2
}
_Rotate/inc.1
]
;
then
/bin/rm
-rf
/
$1
/
$3
/
${
2
}
_Rotate/inc.1
echo
""
echo
"
$date
on /
$1
/
$3
/
${
2
}
_Rotate/inc.1 Directory Created!"
echo
""
fi
#Real DATA inc Copying Link
if
[
-d
/
$1
/
$3
/
$2
]
;
then
/bin/mkdir
-p
/
$1
/
$3
/
${
2
}
_Rotate/inc.1/
$2
/bin/cp
-al
/
$1
/
$3
/
$2
/
*
/
$1
/
$3
/
${
2
}
_Rotate/inc.1/
$2
/
fi
#AFTER DAYS DELETE
/bin/rm
-rf
/
$1
/
$3
/
${
2
}
_Rotate/inc.99
fi
fi
```
>
# DBMS 백업
# DBMS 백업
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment