Tag: ISP. GZ Official image Events Enter the users root
ITDB system setup and real-time backup ITDB Introduction
ITDB is an open source it asset management system from Greece, which is a web-based IT asset information management system. For those companies with more IT equipment and lack of management It assets information tools, ITDB is a good choice, ITDB after three years of development, update whether from the function or interface is a mature product.
Official address: Http://www.sivann.gr/software/itdb/ITDB Asset Management System construction
1. installation Environment
Operating system: centos7_x86_64
ip:192.168.0.119
SQLite version:
2. Install httpd as well as php and php-pdo (PHP operation Database Tools, default sqlite already installed )
#yum Install httpd php php-pdo-y
3. Make sure the httpd boot up
#systemctl Enable Httpd.service
4. start httpd
#systemctl Start Httpd.service
5. Verify that httpd and php are working properly
Create a new test.php file in the server/var/www/html directory with the following contents:
<?php
Echo Phpinfo ();
?>
Terminal Browser Input 192.168.0.119/test.php
If similar occurs, the installation is normal.
6. Download the compressed package
Login Official website: http://www.sivann.gr/software/itdb/, download the appropriate version, this document uses the Itdb-1.23.zip, download complete upload to the server.
7. Unzip the file and copy it to the Web Server root directory
#unzip Itdb-1.23.zip
Then copy the extracted files to the/var/www/html directory:
#cp-R itdb-1.23/*/var/www/html/
Go to/var/www/html and rename the database:
#cp data/pure.db data/itdb.db
To add related permissions:
#chown Apache Itdb.db
#chmod u+w itdb.db
#chown apache/var/www/html/data/files/
# chmod u+w/var/www/html/data/files/
#systemctl Restart Httpd.service
8. Enter the server IP in the browser
See the following page:
You can enter the user name Admin Password Admin Login system, this ITDB system deployment is complete. ITDB Asset Management System real-time backup
Select a server as a backup to hold the backed up files
The following operations are performed on the backup server (192.168.88.8):
1. Install rsync
#yum Install Rsync-y
2. manually add rsync User, this user is used to run the rysnc daemon process
#useradd rsync-s/sbin/nologin
3. Create A module catalog of the rsync Daemon working mode
#mkdir-P/backup/itdb
4. modification of the directory belongs to the main genus Group
#chown Rsync.rsync/backup/itdb
5. to modify the rsync profile /etc/rsyncd.conf , here is a profile case
UID = rsync
GID = rsync
Use chroot = no
Max connections = 50
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsync.lock
Log file =/var/log/rsyncd.log
# exclude = lost+found/
# Transfer logging = yes
Timeout = 300
# Ignore nonreadable = yes
# dont compress = *.gz *.tgz *.zip *.z *. Z *.rpm *.deb *.bz2
# [FTP]
# path =/home/ftp
# comment = FTP export area
#
[ITDB]
Path =/backup/itdb/
Read Only = False
List = False
Host Allow = 192.168.0.0/24
Host Deny = 0.0.0.0/32
Auth_users = Rsync_backup
Secrets file =/etc/rsync.password
This configuration file is mainly modified:
? Uid,gid for Rsync, is to modify the account running Rsync daemon
? Modify use chroot change to No
? Modify timeout time-out
? [ITDB] Identification ID, the subsequent synchronization needs to use,
? The Path is followed by a synchronous directory, which synchronizes the files to this directory.
? Read Only = False whether Read only
? Host allow = 192.168.64.0/18 which network segment is allowed to synchronize
? Host deny = 0.0.0.0/32 other network segments do not allow synchronization
? Auth_users = Rsync_backup used to synchronize the user
? Secrets file =/etc/rsync.password is used to synchronize the user and password that need to be created
6. Create a sync user password file
#vi/etc/rsync.password
Rsync_backup:leesir
Rsync_backup is the sync user, Leesir is the password
7. Set Password file Read permissions
#chmod 600/etc/rsync.password
8 Eighth Step start the rsync daemon
#rsync--daemon
9 Nineth Step See if the 873 port is listening
#netstat-TNLP
TCP 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 19568/rsync
When you see 873-port listening, it's working correctly.
The following operations are performed on the ITDB server:
1. Check whether the current system supports inotify
#ll/proc/sys/fs/inotify/
Total dosage 0
-rw-r--r--1 root root 0 April 14:56 max_queued_events
-rw-r--r--1 root root 0 April 14:56 max_user_instances
-rw-r--r--1 root root 0 April 14:56 max_user_watches
Showing these three documents proves support.
2. Install the installation packages required for compiling and downloading and synchronizing
#yum install wget gcc gcc-c++ make rsync-y
3. Download the inotify Source package and compile the installation
#wget Http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz-P/opt
#cd/opt && Tar xvf inotify-tools-3.14.tar.gz
#cd/opt/inotify-tools-3.14/&&/configure--prefix=/usr/local/inotify
#make && make Install
4. Add sync user password file /etc/rsync.password
Leesir
Only passwords are needed here, no user is required to write
5. Write the monitor, monitor the file change information, synchronize to the backup server in real time , the database used by the ITDB system is sqlite3, The data are all stored in the itdb.db file, as long as the synchronization of this file is OK,itdb.db generally in /var/www/ Html/data directory, so you can synchronize this directory.
Here is a synchronous example/opt/inotify_itdb.sh
#!/bin/bash
#para
host01=192.168.88.80
Src=/var/www/html/data
Dst=itdb
User=rsync_backup
Rsync_passfile=/etc/rsync.password
Inotify_home=/usr/local/inotify
#judge
if [!-e "$src"] \
|| [!-e "${rsync_passfile}"] \
|| [!-e "${inotify_home}/bin/inotifywait"] \
|| [!-e "/usr/bin/rsync"];
Then
echo "Check File and Folder"
Exit 9
Fi
${inotify_home}/bin/inotifywait-mrq--timefmt '%d/%m/%y%h:%m '--format '%T%w%f '-e close_write,delete,create,attrib $ SRC \
| While read file
Do
# RSYNC-AVZP--delete--timeout=100--password-file=${rsync_passfile} $src [email protected] $host:: $dst >/dev/ Null 2>&1
CD $src && rsync-aruz-r--delete/--timeout=100 [email protected] $host:: $dst--PASSWORD-FILE=${RSYNC_PASSFI Le} >/dev/null 2>&1
Done
Exit 0
Explanation:
HOST01 is the backup server IP address, modified according to the actual situation
SRC is a directory that needs to be synchronized, and all files in the directory are synchronized to the backup server in real time
DST is the identification ID of the backup server, corresponding to the backup server settings above, which is the/BACKUP/ITDB directory
User is synchronous
Rsync_passfile is the sync user password file
Inotify_home is the home directory for inotify source installation
The following script means that any changes that affect the contents of the file in the/var/www/html/data directory will be synced to the backup server immediately.
6. Running Scripts in the background
#bash/opt/inotify_itdb.sh &
7. when you modify or add content to the ITDB Web page, and then go to the backup server ls-l View the file, you can find that the file is synchronized
8. if necessary (restore), you can find the import -"Select File on the itdb Web page , select the backup Itdb.db file, you can revert to the latest state
ITDB system setup and real-time backup