vsftp를 이용한 서버에 ftp 설치


작업 개요

- 서버에 파일 전송 프로토콜(File Transfer Protocol) FTP 설치하기 

작업 환경 

서비스 : EC2

AMI : Amazon Linux AMI 2018.03.0

- CentOS 호환가능

작업 내용 

오픈소스인 vsftp를 이용해 서버에 FTP 설치하기



작업 절차 


      1. vsftp가 설치 되었는지 확인한다. 

          - rpm -qa vsftpd*


      2. yum을 이용해 vsftp 페키지를 설치한다.

          - sudo yum install vsftpd -y


      3. vsftp 상태를 확인한다.

          - sudo service vsftpd status


      4. vsftp의 config 내용을 모두 지우고 아래 내용으로 입력한다.

          - sudo vi /etc/vsftpd/vsftpd.conf

---------------------------------------------------------------------------------------------------------------------------------

    anonymous_enable=NO

    local_enable=YES

    write_enable=YES

    local_umask=022

    dirmessage_enable=YES

    xferlog_enable=YES

    connect_from_port_20=YES

    xferlog_file=/var/log/xferlog

    xferlog_std_format=YES

    chroot_local_user=YES

    listen=YES

    pam_service_name=vsftpd

    userlist_enable=YES

    tcp_wrappers=YES

    pasv_enable=NO


      5. vsftp 시작

          - sudo service vsftpd start


6. 해당 작업이 완료 되면 설치 작업이 끝난다. 그런 다음 방화벽에 21번 포트를 열어준다.




그럼 오늘도 행복한 하루 되세요.

haproxy open source 를 사용해 load balancer 구성 하기


작업 개요

- 해당 가이드는 haproxy 오픈소스 로드벨런서를 사용해 L4 L7스위치 대안으로 구성하는 방법을 다룬다.

작업 환경 

서비스 : EC2

AMI : Amazon Linux AMI 2018.03.0

작업 내용 

haproxy 오픈소스 로드벨런서를 EC2 안에 구성을 하고 로드벨런서에  DB연결을 구성한다.



작업 절차 


      1. ec2 생성  

          - test 인스턴스 img :  Amazon Linux AMI 2018.03.0 (HVM), SSD Volume Type


      2. haproxy 구성을 위해 필요 페키지 설치

          - sudo yum -y install haproxy mysql


      3. EC2에서 Aurora Serverless에 접근 가능한지 먼저 확인한다.

          - mysql -h'[end-point]' -u[mysql - user] -p

            ex) mysql -h'test.cluster-cksasdwsxfewefd.ap-northeast-2.rds.amazonaws.com' -uuser -p


      4. haproxy config 파일 수정 -내용을 아래 내용으로 모두 변경한다.

          - sudo vi /etc/haproxy/haproxy.cfg

---------------------------------------------------------------------------------------------------------------------------------

        // 내용

        global


            log         127.0.0.1 local2


            chroot      /var/lib/haproxy

            maxconn     4000

            pidfile     /var/run/haproxy.pid

            user        haproxy

            group       haproxy

            daemon


            stats socket /var/lib/haproxy/stats



        defaults

            log                     global

            option                  tcplog

            option                  dontlognull

            option                  redispatch

            retries                 3

            timeout queue           1m

            timeout connect         10s

            timeout client          1m

            timeout server          1m

            timeout check           10s

            maxconn                 3000


        listen mysql-cluster 0.0.0.0:3306

              mode tcp

              balance roundrobin

              option tcpka

              #server sdm-db1 [aurora serverless end-point]:3306 check

              server sdm-db1 test.cluster-cksasdwsxfewefd.ap-northeast-2.rds.amazonaws.com:3306 check

----------------------------------------------------------------------------------------------------------------------------------------

****listen mysql-cluster 0.0.0.0:3306 에서 입력한 포트를 EC2 보안 그룹에서 외부에서 접속 가능하도록 열어준다.

 만약 여러 RDS를 대상으로 해당 작업을 해야하는 경우 포트만 다르게 여러 연결을 구성하면 된다.


        listen mysql-cluster 0.0.0.0:3306

              mode tcp

              balance roundrobin

              option tcpka

              #server sdm-db1 [aurora serverless end-point]:3306 check

              server sdm-db1 test.cluster-cksasdwsxfewefd.ap-northeast-2.rds.amazonaws.com:3306 check


        listen mysql-cluster 0.0.0.0:3305

              mode tcp

              balance roundrobin

              option tcpka

              #server sdm-db1 [aurora serverless end-point]:3306 check

              server sdm-db1 test.cluster-cksasdwsxfewefd.ap-northeast-2.rds.amazonaws.com:3306 check


      5. haproxy 재시작

          - sudo /etc/init.d/haproxy restart


이상 입니다.ㅎㅎ

그럼 오늘도 행복한 하루 되세요.

+ Recent posts