[root@zoomoney opt]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/prometheus v1 9290fb8f4fad 24 hours ago 303 MB
<Container 이미지 기동>
podman run -d --name prometheus_v1 --pod zoomoney_pro localhost/prometheus:v1
<Grafana 연동>
1.grafana 디렉토리 이동후
buildah bud -t grafana:v1 . 명령어 수행
<빌드된 컨테이너 이미지 확인>
[root@zoomoney ~]# podimg
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/prometheus v1 9290fb8f4fad 24 hours ago 303 MB
localhost/backend v1 163c2883438f 24 hours ago 573 MB
localhost/grafana v1 2d2ae498da92 29 hours ago 671 MB
<Container 이미지 기동>
podman run -d --name grafana_v1 --pod zoomoney_pro localhost/grafana:v1
<Container 확인>
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES POD ID PODNAME
2365106ac006 localhost/grafana:v1 24 hours ago Up 24 hours 0.0.0.0:80->80/tcp, 0.0.0.0:7777->7777/tcp, 0.0.0.0:9091->9090/tcp, 0.0.0.0:33000->3000/tcp, 3000/tcp grafana_v1 89a757316fa5 zoomoney_pro
005a100371c9 localhost/prometheus:v1 --config.file=/et... 24 hours ago Up 24 hours 0.0.0.0:80->80/tcp, 0.0.0.0:7777->7777/tcp, 0.0.0.0:9091->9090/tcp, 0.0.0.0:33000->3000/tcp, 9090/tcp prometheus_v1 89a757316fa5 zoomoney_pro
<접속확인>
1.Grafana 접속 확인
2. Prometheus 가 Zoomoney 프로젝트 엔드포인트에 매트릭스를 수집하는지 Curl 명령어로 확인 결과
[root@zoomoney ~]# curl http://192.168.0.174:7777/zoomoney/actuator/prometheus# HELP application_ready_time_seconds Time taken for the application to be ready to service requests# TYPE application_ready_time_seconds gauge
application_ready_time_seconds{main_application_class="com.shinhan.zoomoney.ZooMoneyBackEndApplication"} 10.454
# HELP application_started_time_seconds Time taken to start the application# TYPE application_started_time_seconds gauge
application_started_time_seconds{main_application_class="com.shinhan.zoomoney.ZooMoneyBackEndApplication"} 10.359
# HELP disk_free_bytes Usable space for path# TYPE disk_free_bytes gauge
disk_free_bytes{path="/."} 2.43263488E9
# HELP disk_total_bytes Total space for path# TYPE disk_total_bytes gauge
disk_total_bytes{path="/."} 1.1416895488E10
# HELP executor_active_threads The approximate number of threads that are actively executing tasks# TYPE executor_active_threads gauge
executor_active_threads{name="applicationTaskExecutor"} 0.0
# HELP executor_completed_tasks_total The approximate total number of tasks that have completed execution# TYPE executor_completed_tasks_total counter
executor_completed_tasks_total{name="applicationTaskExecutor"} 0.0
# HELP executor_pool_core_threads The core number of threads for the pool# TYPE executor_pool_core_threads gauge
executor_pool_core_threads{name="applicationTaskExecutor"} 8.0
# HELP executor_pool_max_threads The maximum allowed number of threads in the pool# TYPE executor_pool_max_threads gauge
executor_pool_max_threads{name="applicationTaskExecutor"} 2.147483647E9
# HELP executor_pool_size_threads The current number of threads in the pool# TYPE executor_pool_size_threads gauge
executor_pool_size_threads{name="applicationTaskExecutor"} 0.0
# HELP executor_queue_remaining_tasks The number of additional elements that this queue can ideally accept without blocking# TYPE executor_queue_remaining_tasks gauge
... 생략...
SQL DUMP는 데이터베이스의 백업 또는 복구를 위한 SQL 파일을 의미함, 데이터베이스의 테이블 구조, 데이터, 인덱스, 뷰, 트리거 등을 SQL 문 형태로 저장한 파일
MaraiaDB cmd 접속
1. MariaDB 접속방법
//mariadb 접속 방법
mysql -h zoomoney.c3msoiki2c17.ap-northeast-2.rds.amazonaws.com -P 3306 -u root -p
Setting environment for MariaDB 11.5 (x64)
C:\Windows\System32>mysql -h zoomoney.c3msoiki2c17.ap-northeast-2.rds.amazonaws.com -P 3306 -u root -p
Enter password: **************** //공유된 RDS 비밀번호
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 151821
Server version: 11.4.4-MariaDB-log managed by https://aws.amazon.com/rds/
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
MariaDB [(none)]> use zoomoney
Database changed
MariaDB [zoomoney]> show tabels;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'tabels' at line 1
MariaDB [zoomoney]> show tabels;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'tabels' at line 1
MariaDB [zoomoney]> show tables;
+----------------------+
| Tables_in_zoomoney |
+----------------------+
| account |
| card |
| category |
| contract |
| daily |
| member |
| money_plan |
| notify |
| plan_detail |
| quiz |
| quiz_keyword |
| stock |
| stock_history |
| stock_history_backup |
| stock_info |
| stock_money |
| stock_result |
| use_history |
+----------------------+
18 rows inset (0.010 sec)
MariaDB [zoomoney]>
2. Zoomoney DB dump 하는법
//DB DUMP 하는방법
mysqldump -h zoomoney.c3msoiki2c17.ap-northeast-2.rds.amazonaws.com -P 3306 -u root -p --databases zoomoney > C:/Users/dydqj/Downloads/zoomoney_dump.sql
옵션 설명
-h : 접속하려는 DB 의 엔드포인트
-P : DB 의 포트번호
-u : user 이름
-p : 비밀번호 문의 유무
--database: db 이름
> C:/Users/dydqj/Downloads/zoomoney_dump.sql : dump 명령어의 결과물을 해당디렉토리의 파일이름.sql로 export 하겠다
C:\Users\dydqj\git\ZooMoney_FrontEnd>npm run build
> zoomoney@0.1.0 build
> react-scripts build
Creating an optimized production build...
Compiled with warnings.
[eslint]
src\card\CardHistory.jsx
Line 9:8: 'cardimage' is defined but never used no-unused-vars
src\moneyPlan\SelectChart.jsx
Line 100:6: React Hook useEffect has a missing dependency: 'findPlanNumByDate'. Either include it or remove the dependency array react-hooks/exhaustive-deps
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
File sizes after gzip:
484 kB (+139 B) build\static\js\main.e1b819db.js
394.29 kB build\static\js\380.80d869ba.chunk.js
44.64 kB (+6 B) build\static\css\main.2584c086.css
1.73 kB build\static\js\206.34ec3213.chunk.js
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
serve -s build
Find out more about deployment here:
https://cra.link/deployment
2.빌드파일 확인(프로젝트 폴더 경로 이동)
경고:>>>build 폴더를 통째로 파일질라로 업로드시 업로드는 가능하나.. 크기에 따라서 시간이 오래걸리면
시간초과로 업로드가 중지될수도있으니,, .tar 나 gzip 파일 처럼 압축해서 올리는것을 권장함
3.파일질라(FileZilla) 로 Front-End 빌드파일 업로드(계정에따라 디렉토리 다를수도있음)
업로드후 압축된 build 파일 해체(tar 로 압축했기때문에 tar 명령어로 압축해제)
[root@zoomoney frontend]# ll
total 13012
-rw-r--r--. 1 zoomoney zoomoney 13317120 Mar 2420:16 build.tar
-rw-r--r--. 1 root root 105 Mar 2416:48 Containerfile
[root@zoomoney frontend]# tar -xvf build.tar
압축해제 확인 후 build 디렉토리로 이동하여 모든파일 frontend 디렉토리 이동(mv 명령어 사용)
[root@zoomoney ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/database v2 5be0615a5483 About a minute ago 471 MB
localhost/backend v2 279c9f331c11 10 minutes ago 571 MB
localhost/frontend v2 e86184a14c0c 16 minutes ago 233 MB
<POD 생성 및 기동상태 확인>
[root@zoomoney ~]# podman pod create --publish 80:80 --publish 7777:7777 --name zoomoney1
3463429f13d138a2c6e79e6e4381c6915071f518247555c85e7aaba29980738f
[root@zoomoney ~]# podman pod ls
POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
3463429f13d1 zoomoney1 Created 5 seconds ago 02d5923b5723 1
77195cd53639 zoomoney Running 16 hours ago 49bb7c151059 4
[root@zoomoney ~]#
<Container 이미지 기동>
podman container run -d --name frontend --pod zoomoney1 localhost/frontend:v2
podman container run -d --name backend --pod zoomoney1 localhost/backend:v2
podman container run -d --name database --pod zoomoney1 localhost/database:v2
Skopeo는 컨테이너 이미지를 다루기 위한 오픈소스 도구로, 주로 컨테이너 이미지의 레지스트리 간 복사, 검사, 메타데이터 조회, 이미지 변환 등을 수행하는 데 사용된다. skopeo는 컨테이너 이미지를 로컬에 저장하지 않고도 원격 레지스트리에서 직접 작업할 수 있기 때문에, Docker나 Podman보다 더 간편하고 빠르게 이미지 작업을 할 수 있다
주요 기능
Skopeo는 하나의 컨테이너 이미지를 다른 레지스트리로 복사할 수 있다. 예를 들어, Docker Hub에서 이미지를 가져와 다른 레지스트리로 이동하는 작업 가능
**쿠버네티스(Kubernetes)**는 컨테이너화된 애플리케이션을 자동으로 배포, 스케일링, 관리하는 오픈소스 컨테이너 오케스트레이션 플랫폼입니다. Google이 처음 개발했으며, 현재는 **Cloud Native Computing Foundation(CNCF)**에서 관리하고 있습니다.
쿠버네티스는 마이크로서비스, 클라우드 네이티브 아키텍처, DevOps 등 현대적인 소프트웨어 개발 방식에서 핵심적인 역할을 합니다.
쿠버네티스의 주요 특징
컨테이너 오케스트레이션
컨테이너화된 애플리케이션을 클러스터에서 효율적으로 관리.
애플리케이션 컨테이너의 배포, 네트워킹, 스케일링, 유지보수를 자동화.
확장성
수평 스케일링(컨테이너 복제) 및 수직 스케일링(리소스 증가)을 통해 애플리케이션을 동적으로 확장 가능.
셀프힐링(Self-healing)
실패한 컨테이너를 자동으로 재시작하거나, 문제가 있는 컨테이너를 교체.
비정상적인 노드에서 실행 중인 컨테이너를 자동으로 종료하고, 대체 가능한 노드로 이동.
자동화
배포(Deployment): 롤링 업데이트, 블루-그린 배포 등 다양한 전략을 제공.
로드 밸런싱: 트래픽 분산으로 안정적인 서비스 제공.
자동 스케일링: 리소스 사용량에 따라 컨테이너 수를 동적으로 조정.
플랫폼 독립성
온프레미스, 퍼블릭 클라우드, 하이브리드 환경에서 모두 사용 가능.
AWS, Google Cloud, Azure 등 다양한 클라우드 플랫폼을 지원.
네트워킹
각 컨테이너 간의 통신, 서비스 디스커버리, 로드 밸런싱을 지원.
쿠버네티스의 주요 구성 요소
1. 클러스터
쿠버네티스는 클러스터 환경에서 작동하며, 클러스터는 여러 대의 머신(노드)으로 구성됨.
노드(Node): 작업이 실제로 수행되는 물리적/가상 서버.
2. 마스터 노드(Master Node)
클러스터를 제어하고 관리하는 중심 역할.
주요 컴포넌트:
API 서버: 클라이언트 요청을 처리.
스케줄러: 작업을 수행할 노드를 결정.
컨트롤러 매니저: 클러스터 상태를 지속적으로 모니터링하고 원하는 상태로 유지.
etcd: 분산 키-값 저장소로 클러스터 상태를 저장.
3. 워커 노드(Worker Node)
애플리케이션이 실제로 실행되는 노드.
주요 컴포넌트:
Kubelet: 노드에서 실행 중인 컨테이너를 관리.
Kube Proxy: 네트워크 통신을 관리.
컨테이너 런타임: 컨테이너를 실행하기 위한 도구(Docker, containerd 등).
4. 파드(Pod)
쿠버네티스의 최소 배포 단위.
하나 이상의 컨테이너가 실행되며, 동일한 네트워크와 스토리지를 공유.
5. 서비스(Service)
클러스터 내부 또는 외부에서 파드에 안정적으로 접근할 수 있는 방법을 제공.
로드 밸런싱 역할을 수행.
6. 네임스페이스(Namespace)
클러스터를 논리적으로 분리하여 다중 사용자가 독립적인 환경을 사용할 수 있게 함.
7. 배포(Deployment)
애플리케이션 배포, 업데이트, 스케일링, 롤백을 정의하고 관리.
쿠버네티스의 주요 장점
확장성과 효율성:
쿠버네티스는 큰 규모의 애플리케이션을 효율적으로 관리하며, 애플리케이션을 자동으로 확장 및 축소 가능.