Search

'2021/04'에 해당되는 글 3건

  1. 2021.04.18 RabbitMQ : Ubuntu에 설치
  2. 2021.04.10 Apache로 Tomcat 로드밸런싱 설정
  3. 2021.04.03 git 파일 추가

RabbitMQ : Ubuntu에 설치

Programming/Java 2021. 4. 18. 21:54 Posted by 파란크리스마스

출처

저장소 추가

bluesanta@bluesanta-desktop:~$ sudo apt list --installed rabbitmq-server
나열 중... 완료

RabbitMQ 설치

bluesanta@bluesanta-desktop:~$ sudo apt install rabbitmq-server
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
  erlang-asn1 erlang-base erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools
  erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl libsctp1
  locales-all
제안하는 패키지:
  erlang erlang-manpages erlang-doc lksctp-tools
다음 새 패키지를 설치할 것입니다:
  erlang-asn1 erlang-base erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools
  erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl libsctp1
  locales-all rabbitmq-server
0개 업그레이드, 20개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
38.1 M바이트 아카이브를 받아야 합니다.
이 작업 후 276 M바이트의 디스크 공간을 더 사용하게 됩니다.

RabbitMQ 실행 상태 확인

bluesanta@bluesanta-desktop:~$ systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ Messaging Server
     Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-04-18 14:23:53 KST; 4min 59s ago
   Main PID: 2625 (beam.smp)
     Status: "Initialized"
      Tasks: 163 (limit: 18897)
     Memory: 85.5M
     CGroup: /system.slice/rabbitmq-server.service
             ├─2608 /bin/sh /usr/sbin/rabbitmq-server
             ├─2625 /usr/lib/erlang/erts-10.6.4/bin/beam.smp -W w -A 128 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbit>
             ├─2970 erl_child_setup 65536
             ├─3007 inet_gethost 4
             └─3008 inet_gethost 4
 
 4월 18 14:23:50 bluesanta-desktop systemd[1]: Starting RabbitMQ Messaging Server...
 4월 18 14:23:53 bluesanta-desktop systemd[1]: rabbitmq-server.service: Supervising process 2625 which is not our child. We'll most likely not notice when it exits.
 4월 18 14:23:53 bluesanta-desktop systemd[1]: Started RabbitMQ Messaging Server.
 4월 18 14:23:53 bluesanta-desktop systemd[1]: rabbitmq-server.service: Supervising process 2625 which is not our child. We'll most likely not notice when it exits.

Management UI 플러그인 활성화

bluesanta@bluesanta-desktop:~$ sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@bluesanta-desktop:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@bluesanta-desktop...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
 
started 3 plugins.

사용자 추가

사용자 목록 조회

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl list_users
Listing users ...
user    tags
guest   [administrator]

사용자 추가

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl add_user admin 'passwd'
Adding user "admin" ...

사용자 권한 부여

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...

암호 변경

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl change_password admin 'passwd'
Changing password for user "admin" ...

RabbitMQ 포트

  • 4369 : epmd, 여러 rabbitmq 서버끼리 서로를 찾을 수 있는 네임 서버 역할을 하는 데몬에서 사용
  • 5672, 5671 : AMQP 를 사용한 메시지 전달
  • 25672 : inter-node 와 CLI Tool 연결
  • 15672 : HTTP API, Management UI

RabbitMQ 관리페이지

웹브라우저로 http://serverip:15672/에 접속

MQTT 플러그인 활성화

bluesanta@bluesanta-desktop:~$ sudo rabbitmq-plugins enable rabbitmq_mqtt
Enabling plugins on node rabbit@bluesanta-desktop:
rabbitmq_mqtt
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_mqtt
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@bluesanta-desktop...
The following plugins have been enabled:
  rabbitmq_mqtt
 
started 1 plugins.
bluesanta@bluesanta-desktop:~$ netstat -nao | grep 1883
tcp6       0      0 :::1883                 :::*                    LISTEN      off (0.00/0/0)

댓글을 달아 주세요

Apache로 Tomcat 로드밸런싱 설정

Programming/Apache, PHP 2021. 4. 10. 13:04 Posted by 파란크리스마스

출처

필수 라이브러리 설치

bluesanta@bluesanta-desktop:~$ sudo apt install libexpat1-dev libssl-dev

PCRE 설치

bluesanta@bluesanta-desktop:~$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
bluesanta@bluesanta-desktop:~$ tar xvf pcre-8.44.tar.gz 
bluesanta@bluesanta-desktop:~$ cd pcre-8.44/
bluesanta@bluesanta-desktop:~/pcre-8.44$ ./configure --prefix=/usr/local/pcre-8.44
bluesanta@bluesanta-desktop:~/pcre-8.44$ make
bluesanta@bluesanta-desktop:~/pcre-8.44$ sudo make install

Apache 웹서버 설치

bluesanta@bluesanta-desktop:~$ wget https://archive.apache.org/dist/httpd/httpd-2.4.39.tar.gz
bluesanta@bluesanta-desktop:~$ tar xvf httpd-2.4.39.tar.gz 
bluesanta@bluesanta-desktop:~$ cd httpd-2.4.39/
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ cd srclib
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ wget https://archive.apache.org/dist/apr/apr-1.7.0.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ tar xvfz apr-1.7.0.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ mv apr-1.7.0 apr
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ wget https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ tar xvfz apr-util-1.6.1.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ mv apr-util-1.6.1 apr-util
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ tar xvfz pcre-8.44.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ mv pcre-8.44 pcre
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ cd ..
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ ./configure --prefix=/opt/apache24 --with-pcre=/usr/local/pcre-8.44 --enable-cgi --enable-info --enable-deflate --enable-ssl --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-ftp --enable-expires --enable-headers --enable-rewrite --enable-so --with-included-apr --with-included-apr-util --with-included-pcre
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ make
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ make install

mod_jk 설치

bluesanta@bluesanta-desktop:~$ wget https://archive.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz
bluesanta@bluesanta-desktop:~$ tar xvf tomcat-connectors-1.2.46-src.tar.gz
bluesanta@bluesanta-desktop:~$ cd tomcat-connectors-1.2.46-src/native/
bluesanta@bluesanta-desktop:~$ ./configure --with-apxs=/opt/apache24//bin/apxs
bluesanta@bluesanta-desktop:~/tomcat-connectors-1.2.46-src/native$ make
bluesanta@bluesanta-desktop:~/tomcat-connectors-1.2.46-src/native$ make install

로드밸런싱 설정

bluesanta@bluesanta-desktop:~$ cd /opt/apache24/conf/
bluesanta@bluesanta-desktop:/opt/apache24/conf$ vi workers.properties

workers.properties

worker.list=load_balancer

worker.load_balancer.type=lb
worker.load_balancer.balance_workers=tomcat1,tomcat2
#worker.load_balancer.balance_workers=tomcat2

# tomcat/conf/server.xml - ajp 포트
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1

# tomcat/conf/server.xml - ajp 포트
worker.tomcat2.port=7009
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1

httpd.conf

bluesanta@bluesanta-desktop:/opt/apache24/conf$ vi httpd.conf

LoadModule jk_module modules/mod_jk.so

... 생략 ...

<IfModule jk_module>
    JkWorkersFile    conf/workers.properties
    JkLogFile        logs/mod_jk.log
    JkLogLevel       info
    JkMount /* 	load_balancer
</IfModule>

Apache 웹서버 환경 설정

bluesanta@bluesanta-desktop:~$ cd /opt/apache24/conf/
bluesanta@bluesanta-desktop:/opt/apache24/conf$ vi httpd.conf

ServerName 주석을 풀고 localhost로 설정

#ServerName www.example.com:80
ServerName localhost

서비스 등록 파일 apache2.service 생성

bluesanta@bluesanta-desktop:/opt/apache24/conf$ cd /opt/apache24/bin/
bluesanta@bluesanta-desktop:/opt/apache24/bin$ vi apache2.service

apache2.service 내용

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/

[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/opt/apache24/bin/apachectl start
ExecStop=/opt/apache24/bin/apachectl stop
ExecReload=/opt/apache24/bin/apachectl graceful
PrivateTmp=true
Restart=on-abort

[Install]
WantedBy=multi-user.target

apache2.service 파일 /etc/systemd/system 디렉토리에 복사

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo chmod +x apache2.service
bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo cp apache2.service /etc/systemd/system

Apache 서비스 등록

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo systemctl enable apache2
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /etc/systemd/system/apache2.service.

Apache 서비스 실행

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo systemctl start apache2

Apache 서비스 상태 확인

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/etc/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-04-10 14:22:21 KST; 57s ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 284736 (httpd)
      Tasks: 82 (limit: 18898)
     Memory: 7.2M
     CGroup: /system.slice/apache2.service
             ├─284736 /opt/apache24/bin/httpd -k start
             ├─284737 /opt/apache24/bin/httpd -k start
             ├─284738 /opt/apache24/bin/httpd -k start
             └─284739 /opt/apache24/bin/httpd -k start
 
 4월 10 14:22:21 bluesanta-desktop systemd[1]: Starting The Apache HTTP Server...
 4월 10 14:22:21 bluesanta-desktop systemd[1]: Started The Apache HTTP Server.

댓글을 달아 주세요

git 파일 추가

Programming 2021. 4. 3. 12:10 Posted by 파란크리스마스

출처

추가할 파일이 있는지 확인

$ git status
On branch master
Your branch is up to date with 'origin/master'.
 
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        dist_admin.sh
 
nothing added to commit but untracked files present (use "git add" to track)

git 파일 추가

$ git add dist_admin.sh

추가한 파일 Repository에 commit

$ git commit -m "add dist_admin.sh"
[master de5e9a98] add dist_admin.sh
 Committer: EC2 Default User <ec2-user@-------------------------->
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:
 
    git config --global --edit
 
After doing this, you may fix the identity used for this commit with:
 
    git commit --amend --reset-author
 
 1 file changed, 7 insertions(+)
 create mode 100755 dist_admin.sh

원격 저장소에 push

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
 
nothing to commit, working tree clean
$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 441 bytes | 441.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/-----/--------
   b9b9e27d..de5e9a98  master -> master

댓글을 달아 주세요