์ด ๊ฒ์๋ฌผ์์๋ ๊ฐ๋จํ inotify + createrepo ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ rpm ์ํฐํฉํธ ์ ์ฅ์๋ฅผ ์ดํด๋ณด๊ฒ ์ต๋๋ค. ์ํฐํฉํธ๋ apache httpd๋ฅผ ์ฌ์ฉํ์ฌ webdav๋ฅผ ํตํด ์ ๋ก๋๋ฉ๋๋ค. apache httpd๊ฐ ๊ฒ์๋ฌผ์ ๋ ๋ถ๋ถ์ ์์ฑ๋๋ ์ด์ .
๋ฐ๋ผ์ ์๋ฃจ์ ์ RPM ์คํ ๋ฆฌ์ง๋ง ๊ตฌ์ฑํ๊ธฐ ์ํ ๋ค์ ์๊ตฌ ์ฌํญ์ ์ถฉ์กฑํด์ผ ํฉ๋๋ค.
-
๋ฌด๋ฃ
-
์ํฐํฉํธ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์ ๋ก๋ํ ํ ๋ช ์ด ํ์ ๋ฆฌํฌ์งํ ๋ฆฌ์์ ํจํค์ง๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
-
์ค์น ๋ฐ ์ ์ง ๋ณด์ ์ฉ์ด
-
๊ณ ๊ฐ์ฉ์ฑ์ ๋ง๋๋ ๊ธฐ๋ฅ
์ ์ ๋ผ
์๋ํ์ ๋ฅ์์ค ๋๋ํํ : -
์ ์ฅ ์ฅ์
์๋ํ์ ๋ฅ์์ค ๋๋ํํ ๋ง์ ์ ํ์ ์ํฐํฉํธ๊ฐ์๋ํ์ ๋ฅ์์ค ๋๋ํํ ๋จ์ผ ์คํจ ์ง์ ์ด ๋ฉ๋๋ค. -
๊ณ ๊ฐ์ฉ์ฑ
์๋ํ์ ๋ฅ์์ค ์ง๊ธ๋ฉ๋๋ค. -
ํํ ๋์๊ฒ ๊ณผ๋ํ๊ฒ ์ค๊ณ๋ ์๋ฃจ์ ์ฒ๋ผ ๋ณด์ ๋๋ค. -
์ ๋ฌผ
์๋ํ์ ๋ฅ์์ค Blob์ ์ ์ฅ๋ฉ๋๋ค. ๊ฐ์์ค๋ฌ์ด ์ ์ ์ ๋ฐฑ์ ์ด ์์ผ๋ฉด Blob์ ๋ณต์ํ ์ ์์ต๋๋ค. ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.ERROR [ForkJoinPool.commonPool-worker-2] *SYSTEM [com.orientechnologies.orient.core.storage](http://com.orientechnologies.orient.core.storage/).fs.OFileClassic - $ANSI{green {db=security}} Error during data read for file 'privilege_5.pcl' 1-th attempt [java.io](http://java.io/).IOException: Bad address
. Blob์ ๋ณต๊ตฌ๋์ง ์์์ต๋๋ค.
์์ค ์ฝ๋
โ ์์ค ์ฝ๋ ์์น
๊ธฐ๋ณธ ์คํฌ๋ฆฝํธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
#!/bin/bash
source /etc/inotify-createrepo.conf
LOGFILE=/var/log/inotify-createrepo.log
function monitoring() {
inotifywait -e close_write,delete -msrq --exclude ".repodata|.olddata|repodata" "${REPO}" | while read events
do
echo $events >> $LOGFILE
touch /tmp/need_create
done
}
function run_createrepo() {
while true; do
if [ -f /tmp/need_create ];
then
rm -f /tmp/need_create
echo "start createrepo $(date --rfc-3339=seconds)"
/usr/bin/createrepo --update "${REPO}"
echo "finish createrepo $(date --rfc-3339=seconds)"
fi
sleep 1
done
}
echo "Start filesystem monitoring: Directory is $REPO, monitor logfile is $LOGFILE"
monitoring >> $LOGFILE &
run_createrepo >> $LOGFILE &
์ค์น
inotify-createrepo๋ CentOS 7 ์ด์์์๋ง ์๋ํฉ๋๋ค. CentOS 6์์ ์๋ํ์ง ๋ชปํ์ต๋๋ค.
yum -y install yum-plugin-copr
yum copr enable antonpatsev/inotify-createrepo
yum -y install inotify-createrepo
systemctl start inotify-createrepo
๊ตฌ์ฑ
๊ธฐ๋ณธ์ ์ผ๋ก inotify-createrepo๋ ๋๋ ํ ๋ฆฌ๋ฅผ ๋ชจ๋ํฐ๋งํฉ๋๋ค. /var/www/repos/rpm-repo/
.
ํ์ผ์์ ์ด ๋๋ ํ ๋ฆฌ๋ฅผ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค. /etc/inotify-createrepo.conf.
์ฌ์ฉ
๋๋ ํ ๋ฆฌ์ ํ์ผ์ ์ถ๊ฐํ ๋ /var/www/repos/rpm-repo/
inotifywait๋ ํ์ผ์ ์์ฑํฉ๋๋ค. /tmp/need_create
. run_createrepo ํจ์๋ ๋ฌดํ ๋ฃจํ์์ ์คํ๋๋ฉฐ ํ์ผ์ ๋ชจ๋ํฐ๋งํฉ๋๋ค. /tmp/need_create
. ํ์ผ์ด ์์ผ๋ฉด ๋ค์์ ์คํํ์ญ์์ค. createrepo --update
.
ํญ๋ชฉ์ด ํ์ผ์ ๋ํ๋ฉ๋๋ค.
/var/www/repos/rpm-repo/ CREATE nginx-1.16.1-1.el7.ngx.x86_64.rpm
start createrepo 2020-03-02 09:46:21+03:00
Spawning worker 0 with 1 pkgs
Spawning worker 1 with 0 pkgs
Spawning worker 2 with 0 pkgs
Spawning worker 3 with 0 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
finish createrepo 2020-03-02 09:46:22+03:00
๊ณ ๊ฐ์ฉ์ฑ์ ๋ง๋๋ ๊ธฐ๋ฅ
๊ธฐ์กด ์๋ฃจ์
์์ ๊ณ ๊ฐ์ฉ์ฑ์ ํ๋ณดํ๋ ค๋ฉด HA์ฉ Keepalived์ ์ํฐํฉํธ ๋๊ธฐํ์ฉ Lsyncd์ 2๊ฐ ์๋ฒ๋ฅผ ์ฌ์ฉํ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
WebDAV๋ฅผ
ํ์ผ์ ์ ๋ก๋ํ๋ ๋ฐฉ๋ฒ์๋ SSH, NFS, WebDav ๋ฑ ์ฌ๋ฌ ๊ฐ์ง๊ฐ ์์ต๋๋ค. WebDav๋ ํ๋์ ์ด๊ณ ๊ฐ๋จํ ์ต์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค.
WebDav์ ๊ฒฝ์ฐ Apache httpd๋ฅผ ์ฌ์ฉํฉ๋๋ค. Apache๊ฐ 2020๋ ์ httpd๊ฐ ๋๊ณ nginx๊ฐ ์๋ ์ด์ ๋ ๋ฌด์์ ๋๊น?
Nginx + ๋ชจ๋(์: Webdav)์ ๊ตฌ์ถํ๊ธฐ ์ํด ์๋ํ๋ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ๊ณ ์ถ์ต๋๋ค.
Nginx + ๋ชจ๋์ ๋น๋ํ๋ ํ๋ก์ ํธ๊ฐ ์์ต๋๋ค -
ํ ๋ฆฌํ์คํธ๋ฅผ ํ์ต๋๋ค
๊ตฌ์ฑ webdav.conf
DavLockDB /var/www/html/DavLock
<VirtualHost localhost:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
Alias /rpm /var/www/repos/rpm-repo
<Directory /var/www/repos/rpm-repo>
DAV On
Options Indexes FollowSymlinks SymLinksifOwnerMatch IncludesNOEXEC
IndexOptions NameWidth=* DescriptionWidth=*
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
๋๋จธ์ง Apache httpd ๊ตฌ์ฑ์ ์ฌ์ฉ์๊ฐ ์ง์ ์ํํ ๊ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค.
Apache httpd ์์ Nginx
Apache์ ๋ฌ๋ฆฌ Nginx๋ ์ด๋ฒคํธ ๊ธฐ๋ฐ ์์ฒญ ์ฒ๋ฆฌ ๋ชจ๋ธ์ ์ฌ์ฉํฉ๋๋ค. ์ฆ, ์ฌ๋ฌ ํด๋ผ์ด์ธํธ์ ํ๋์ HTTP ์๋ฒ ํ๋ก์ธ์ค๋ง ํ์ํฉ๋๋ค. nginx๋ฅผ ์ฌ์ฉํ์ฌ ์๋ฒ ๋ถํ๋ฅผ ์ค์ผ ์ ์์ต๋๋ค.
nginx-front.conf ๊ตฌ์ฑ. nginx ๊ตฌ์ฑ์ ๋๋จธ์ง ๋ถ๋ถ์ ์ง์ ์ํํ ๊ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค.
upstream nginx_front {
server localhost:80;
}
server {
listen 443 ssl;
server_name ะฒะฐั-ะฒะธัััะฐะปัะฝัั
-ั
ะพัั;
access_log /var/log/nginx/nginx-front-access.log main;
error_log /var/log/nginx/nginx-front.conf-error.log warn;
location / {
proxy_pass http://nginx_front;
}
}
WebDav๋ฅผ ํตํด ํ์ผ ๋ค์ด๋ก๋
rpm ๋ค์ด๋ก๋๋ ๋งค์ฐ ์ฝ์ต๋๋ค.
curl -T ./nginx-1.16.1-1.el7.ngx.x86_64.rpm https://ะฒะฐั-ะฒะธัััะฐะปัะฝัะน-ั
ะพัั/rpm/
์ถ์ฒ : habr.com