Apache가 설치되어 있을 때, 해당 Apache가 설치된 컴파일 옵션을 아래 경로의 파일을 cat이나 vi로 열어봄으로써 확인 가능하다.

[아파치설치경로]/build/config.nice

예를 들어 아파치 설치 경로가 /usr/local/apache 라면, cat명령어를 이용하여 아래와 같이 간단히 확인할 수 있다.

# cat /usr/local/apache/build/config.nice


 

서버호스팅 트래픽을 보면 3메가, 5메가, 10메가 등이 있습니다.
이는 초당 접속속도를 이야기 하며 단위는 bps (bit per second) 입니다.
이를 일반 웹호스팅에 빗대어 (예를들어 하루 전송량 1기가) 이야기 하면
계산하는 방법이 아래와 같습니다.

<3Mbps>

3Mbps
= 3*1024*1024 bit
= 3,145,728 bit
bit 를 byte 로 전환하면 (byte 는 bit 가 8개 모인 단위입니다.)
3Mbps / 8
= 3,145,728 / 8
= 393,216 byte
즉 초당 데이터 전송할 수 있는 양이 384 Kbyte 가 됩니다.
이를 하루 단위 트래픽으로 계산하면  다음과 같습니다.
393,216 byte * 86,400 초 (하루 60*60*24)
= 33,973,862,400 byte
= 약 32 Gbyte
즉 하루 트래픽은 32기가 정도 되는 것이며 이를 한달로 계산하면 약 950 Gbyte 입니다.

<5Mbps>
초당 : 640 Kbyte
하루 : 약 52 Gbyte
한달 : 약 1,582 Gbyte 

<10Mbps>
초당 : 1.25 Mbyte
하루 : 약 105 Gbyte
한달 : 약 3,164 Gbyte
 
이는 단순 계산한 것이고 실제 운영시에는 조금 다를 수 있습니다.


CentOS 6까지는 /etc/sysconfig/network 설정파일에 정의 도었지만 CentOS 7 부터는 새로운 init시스템(systemd) 으로 변경되면서

/etc/hostname 에 의해 정의된다.

hostnamectl 이라는 명령어가 추가되었는데, 이 명령을 이용해 hostname을 조작할 수 있다.

1. hostname 상태 확인하기

# hostnamectl status
   Static hostname: web.yufunding.com
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: c9b7cf08f05840c08378307dccc659c8
           Boot ID: 309a6f6094a8436fb89e5f38de46987d
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.36.2.el7.x86_64
      Architecture: x86-64

2. hostname 변경하기

# hostnamectl set-hostname [호스트명]

3. hostname 변경 후 확인

# hostname 명령어로 확인하거나 (Cent 4, Cent5, Cent6 부터 사용한 기본 명령어)

cat /etc/hostname 명령어로 /etc/hostname 파일에 정의한 hostname 이 입력되어 있는지 확인

/etc/hostname 에 정의가 되어 있으면 재부팅되어도 적용됨.

'Works > CentOS & RockyLinux' 카테고리의 다른 글

lastb - 로그인 실패 로그 확인  (0) 2017.02.14
CentOS 다운로드 미러 사이트  (0) 2017.01.03
tmpwatch  (0) 2016.10.19
du 명령어의 활용  (0) 2016.09.02
필요한 rpm 패키지를 다운받자  (0) 2016.08.03


증상) 윈도우 업데이트 시도시 아래와 같은 내용의 창이 뜨면서 실행되지 않는 현상이 발생한다.

창 내용 -> 서비스가 실행되고 있지 않으므로 Windows Update에서 현재 업데이트를 확인할 수 없습니다.
               컴퓨터를 다시 시작해야 할 수도 있습니다.

알려진원인) 윈도우 서비스에 문제가 있어 발생하는 현상이라고 한다.

해결책)

1. 업데이트 서비스 자체가 중지되어 있는 경우

업데이트 서비스가 중지된 경우에도 위와 같은 현상이 발생할 수 있는데 이럴때는 서비스를 다시 기동하면 문제가 해결 될 수 있다.

시작버튼 -> 실행 -> services.msc 입력 후 엔터

Windows Update 서비스 항목이 중지됨 이거나 시작유형이 사용 안 함 으로 되어 있을 경우 이를 시작해준다.

이 후 다시 업데이트를 시도해본다. (업데이트가 시작되면 문제 해결)

2. 업데이트 서비스 기동으로도 해결이 안되는 경우

1번으로 해결이 안되는 경우라면 윈도우 업데이트 폴더 오류 가능성이 매우 높다.

이런경우 업데이트 폴더를 재생성 해주어야 하는데, 우선 1번에 명시된 Windows Update 서비스를 중지시켜준다.

(시작되어 있는 경우라도 반드시 중지할 것)

이후 C:\Windows  경로로 이동하여 SoftwareDistribution 폴더 이름을 다른 이름으로 변경해준다.

폴더 이름은 임의로 지정되도 되지만 어떤 폴더인지 알아 볼수 있도록 지정하는 것이 좋다.

마지막으로 services.msc 에서 Windows Update 서비스를 다시시작하면 자동으로 SoftwareDistribution 가 생성되면서

업데이트가 실행되는 것을 확인 할 수 있다. (이름 변경한 기존 SoftwareDistribution는 삭제할 것)

MySQL 의 기본 스토리지 엔진이 무엇인지 확인하고자 할 때 아래 Query 를 실행 할 것

SQL>SELECT engine, support FROM information_schema.engines WHERE support='DEFAULT';

예시)

mysql> SELECT engine, support FROM information_schema.engines WHERE support='DEFAULT';
+--------+---------+
| engine   | support  |
+--------+---------+
| InnoDB  | DEFAULT |
+--------+---------+
1 row in set (0.03 sec)


 

읽기 가능한 파일(또는 폴더)인지 체크하는 is_readable 함수


bool is_readable ( string $filename )
(PHP 4, PHP 5)

읽기 가능한 파일(또는 폴더)이면 true를 반환하고, 아니면 false를 반환합니다.

예제 (ex #3

 <?php
 
if (is_readable('test.txt'
)) {
    echo 
'읽기 가능한 파일입니다.'
;
 }else{
    echo 
'읽기 권한이 없는 파일입니다. 권한 0707, 0777로 바꿔주세요.'
;
 }
 
?>


쓰기 가능한 파일(또는 폴더)인지 체크하는 is_writable 함수


bool is_writable ( string $filename )
(PHP 4, PHP 5)

쓰기 가능한 파일(또는 폴더)이면 true를 반환하고, 아니면 false를 반환합니다.

예제 (ex #4

 <?php
 
if (is_writable('test.txt'
)) {
    echo 
'쓰기 가능한 파일입니다.'
;
 }else{
    echo 
'쓰기 권한이 없는 파일입니다. 권한 0707, 0777로 바꿔주세요.'
;
 }
 
?>


실행 가능한 파일인지 체크하는 is_executable 함수


bool is_executable ( string $filename )
(PHP 4, PHP 5)

실행 가능한 파일이면 true를 반환하고, 아니면 false를 반환합니다.

예제 (ex #5

 <?php
 
if (is_executable('test.txt'
)) {
    echo 
'실행 가능한 파일입니다.'
;
 }else{
    echo 
'실행 권한이 없는 파일입니다. 권한 0707, 0777로 바꿔주세요.'
;
 }
 
?>


읽기, 쓰기, 실행의 권한 문제에 대한 설명은 퍼미션(Permission) 설정을 참고하십시요.

[출처] : http://blog.habonyphp.com/entry/php-%EC%9D%BD%EA%B8%B0-%EC%93%B0%EA%B8%B0-%EC%8B%A4%ED%96%89%EC%9D%B4-%EA%B0%80%EB%8A%A5%ED%95%9C-%ED%8F%B4%EB%8D%94-%ED%8C%8C%EC%9D%BC%EC%9D%B8%EC%A7%80-%EC%B2%B4%ED%81%AC%ED%95%98%EB%8A%94-%ED%95%A8%EC%88%98#.WA7E9U__qUk



tmpwatch 라는 명령

일정 시간동안 접근이 없는 파일 삭제하기
 

yum -y install tmpwatch


[root@howtounix hack]# ll
total 16
-rwxr-xr-x 1 root root 8486 Aug 24 17:36 a.out
-rw-r--r-- 1 root root 1044 Aug 24 15:42 test.c

24시간 이후로 접근이 없는 파일들 삭제

[root@howtounix hack]# tmpwatch --atime 24 ./
[root@howtounix hack]# ll
total 0


간단하네.

       -u, --atime
              Make the decision about deleting a file based on the file’s atime (access time). This is
              the default.

              Note that the periodic updatedb file system scans keep the atime of directories  recent.

       -m, --mtime
              Make  the  decision  about deleting a file based on the file’s mtime (modification time)
              instead of the atime.

       -c, --ctime
              Make the decision about deleting a file based on the file’s ctime  (inode  change  time)
              instead of the atime; for directories, make the decision based on the mtime.

       -M, --dirmtime
              Make  the  decision about deleting a directory based on the directory’s mtime (modifica-
              tion time) instead of the atime; completely ignore atime for directories.

[출처] https://opentutorials.org/module/981/8083

'Works > CentOS & RockyLinux' 카테고리의 다른 글

CentOS 다운로드 미러 사이트  (0) 2017.01.03
CentOS7 hostname 설정  (0) 2016.10.31
du 명령어의 활용  (0) 2016.09.02
필요한 rpm 패키지를 다운받자  (0) 2016.08.03
xferlog 항목별 분석  (0) 2016.07.27


PHP에서 MS-SQL 서버를 연동하기 위한 방법입니다

- PHP의 mssql extension을 컴파일 하기 위해서는 FreeTDS 라이브러리가 필요합니다.
  본문에서는 APM은 이미 설치되어 있는 것으로 가정하고 Freetds는 소스 설치, mssql 모듈은 extension으로 설치 하겠습니다.


(1) FreeTDS 설치

   # wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

   # tar xvzf freetds-stable.tgz

   # cd freetds-0.91

   # ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --disable-odbc --disable-debug --enable-msdblib

   # make && make install

 

(2) freetds.conf 설정 및 ms-sql 접속 Test

   # vi /usr/local/freetds/etc/freetds.conf

 

- 아래의 항목 추가

   [TestMSSQL]
   host = IP주소
   port = 1433
   tds version = 8.0
   client Charset = UTF-8
  * tds version : 접속 하고자 하는 SQL Server 버젼에 맞게 수정.


(3) MS-SQL 접속 테스트

   # /usr/local/freetds/bin/tsql -H ip주소 -p 1433 -U db계정 -P 비밀번호


(4) mssql 모듈 설치

   # cd /usr/local/src/php-5.2.9/ext/mssql

   # /usr/local/php/bin/phpize

   # ./configure --with-mssql=/usr/local/freetds --with-php-config=/usr/local/php/bin/php-config

   # make

   # cp .libs/mssql.so /PHP Extension 디렉토리

   # vi /usr/local/php/lib/php.ini
     extension=mssql.so <---- 추가

    # apache 재구동


(5) 모듈 설치 확인 - phpinfo의 mssql 항목 확인 및 php -i 옵션으로 확인

   # /usr/local/php/bin/php -i | grep mssql
   mssql
   mssql.allow_persistent => On => On
   mssql.batchsize => 0 => 0
   mssql.charset => no value => no value
   mssql.compatability_mode => Off => Off
   mssql.connect_timeout => 5 => 5
   mssql.datetimeconvert => On => On
   mssql.max_links => Unlimited => Unlimited
   mssql.max_persistent => Unlimited => Unlimited
   mssql.max_procs => Unlimited => Unlimited
   mssql.min_error_severity => 10 => 10
   mssql.min_message_severity => 10 => 10
   mssql.secure_connection => Off => Off
   mssql.textlimit => Server default => Server default
   mssql.textsize => Server default => Server default

   mssql.timeout => 60 => 60

[mssql 접속을 위한 테스트 페이지 샘플]

<?php
 
   putenv("FREETDSCONF=C:\freetds.conf");  // 이 두줄은 빼도 되면 빼고 안되면 넣고.. 알아서..
    putenv("TDSVER=80");


     $link = mssql_connect('dbserver', 'DB아이디', 'DB비밀번호');
     if(!$link) {
        echo'Could not connect';
     }else{
      echo'Successful connection';

     }
     mssql_close($link);
 ?>


출처 : http://faq.hostway.co.kr/Linux_WEB/1261


'Works > 확장모듈설치매뉴얼' 카테고리의 다른 글

Zend Guard Loader 설치  (0) 2017.05.17
APC 확장모듈 설치  (0) 2017.04.26
mod_mime_magic 설치  (0) 2016.08.01
oAuth 확장모듈 설치  (0) 2016.03.29
CentOS6 에서 mcrypt 확장모듈 설치시의 방법  (0) 2016.02.26


du -sh . --exclude='패턴' (현재 위치에서 '패턴' 파일 또는 폴더를 제외하고 전체 용량을 확인)
du -sh * --exclude='패턴' (현재 위치에서 '패턴' 파일 또는 폴더를 제외한 모든 항목들의 개별 용량 확인)

용량이 1기가바이트 이상인 파일이나 디렉토리만 보고 싶다면 아래처럼 grep을 활용할 수도 있습니다.

du -sh ./* | grep G

'Works > CentOS & RockyLinux' 카테고리의 다른 글

CentOS7 hostname 설정  (0) 2016.10.31
tmpwatch  (0) 2016.10.19
필요한 rpm 패키지를 다운받자  (0) 2016.08.03
xferlog 항목별 분석  (0) 2016.07.27
smartctl을 이용한 하드디스크 진단 { DRDY ERR } 확인  (0) 2016.07.06


/usr/local/apache/bin/apachectl restart 를 이용해 


Apache를 재시작 하려는데 다음과 같은 메시지가 뜨는 경우가 있습니다.

=================================================
(20014)Internal error: Error retrieving pid file logs/httpd.pid
Remove it before continuing if it is corrupted.

=================================================



기존에 구동중인 아파치가 정상 종료 되지 않을 경우 프로세스가 남아 있게 되어 발생되는 부분으로

구동중인 httpd 데몬을 전부 종료하고 다시 시작하시면 되겠습니다.


종료:
killall -9 httpd

구동:
/usr/local/apache/bin/apachectl start

그래도 정상 구동이 되지 않을 시 해당 httpd.pid 파일을 삭제 하신 뒤 재시작하여 보시기 바랍니다.

해당 파일은 구동 시 자동 생성 되는 파일이므로 삭제 후 재시작을 하여도 무방합니다.

출처 : http://faq.hostway.co.kr/Linux_WEB/7565