Quick Start 가이드

https://james.apache.org/server/quick-start.html

 

Apache James Project – Apache James Server 3 - Quick Start

Quick Start The goal of the document is to allow anyone to start with James binary Spring distribution as an operational mail server. For more complete ways of deploying James server please refer to the James installation guide Step 0: Requirements #######

james.apache.org

 

Step 0: Requirements

더보기

Step 0: Requirements
####################

  * JDK 11
  * root (linux/unix) or Administrator (Windows)
  * libc6 (linux)
  * 512MB RAM (launches with -Xmx512M - can use less, can need more, depending on load)

Step 0-1: JDK 11 설치

$ sudo apt-get update

$ sudo apt-get install openjdk-11-jdk

$ sudo apt-get install openjdk-11-jre

$ which javac

-> /usr/bin/javac

$ readlink -f /usr/bin/javac

-> /usr/lib/jvm/java-11-openjdk-amd64/bin/javac

$ vi /etc/environment

-> JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

$ source /etc/environment

Step 0-1: libc6 설치

$ sudo apt-get install libc6-i386 libc6-dev-i386

 

Step 1: Download

더보기

Step 1: Download
#################

  * Download apache-james-3.3.0-app.zip from http://james.apache.org/download.cgi#Apache_James_Server

https://james.apache.org/download.cgi#Apache_James_Server

 

Apache James Project – Download

Downloading Use the links below to download the product from one of our mirrors. You must verify the integrity of the downloaded files using signatures KEYS downloaded from our main distribution directory. (*) James maven repositories can be found on http

james.apache.org

$ wget https://www.apache.org/dyn/closer.lua/james/server/3.7.0/james-server-app-3.7.0-app.zip

 

Step 2: Deploy

더보기

Step 2: Deploy
##############

  * Unzip apache-james-3.3.0-app.zip.
  * You should have a folder with sub-folders bin, conf, lib, log, var and four text files.

$ unzip apache-james-3.3.0-app.zip
$ cd apache-james-3.3.0-app
$ ls (linux) / dir (windows)
bin
BUILD.txt
conf
lib
LICENSE.txt
log
NOTICE.txt
README.txt
var

$ unzip james-server-app-3.7.0-app

 

Step 3: Understand James Features

더보기

Step 3: Understand James Features
#################################

Persistence
- Mailbox is for users' Inbox, Sent Items, Trash... folders - Mailbox persistence is configured in spring-beans.xml (by default jpa, you set the database connection properties in database.properties). We think to move this config out-of spring-beans.xml.
- Mailrepositorystore is for spam, error,... mails, so nothing to do with users visible mails. Available mailstore persistence are defined in mailstore.xml. Each has an URL prefix (file, db, dbfile,...) that can be used in mailetcontainer.xml to define where to store spam,... mails (exemple: file://var/mail/error/).
- Domain persistence is configured in domainlist.xml
- Users persistence is configured in usersrepository.xml
- All database connection use the database.properties in case of database access.

Mailet Container - http://james.apache.org/server/feature-mailetcontainer.html

SMTP Hooks - http://james.apache.org/server/feature-smtp-hooks.html

 

Step 4: Configure

더보기

Step 4: Configure
#################

  * All configuration files are embedded in jars.
  * We ship in the conf folder the configuration files.
  * You can override the default configuration by editing these files

database.properties
META-INF/persistence.xml
dnsservice.xml
domainlist.xml
fetchmail.xml
imapserver.xml
james-listmanager.xml
jmx.properties
lmtpserver.xml
log4j.properties
mailetcontainer.xml
mailbox.xml
mailserver.xml
mailrepositorystore.xml
pop3server.xml
recipientrewritetable.xml
smtpserver.xml
sqlResources.xml
usersrepository.xml
wrapper.xml
lib folder (for your additional jar, e.g. JDBC drviers,...)

James is packaged with virtual hosting enabled, JPA (Derby database) storage for the mails, users, and domains.
On SMTP (see smtpserver.xml config)
  * authRequired is true by default, so you can safely deploy James on the Internet (it won't be an open relay).
  * verifyIdentity is true by default (you can only send mails with a FROM being the authenticated user).

To use another database:
  * Edit the database.properties and change the values according to your database.
  * Add the needed JDBC driver jar in the ./conf/lib folder according to your database.

dnsservice.xml
domainlist.xml
fetchmail.xml
imapserver.xml
indexer.xml
james-database.properties
jetm-monitoring.xml
jmx.properties
lmtpserver.xml
log4j2.xml
mailbox.xml
mailetcontainer.xml
mailrepositorystore.xml
managesieveserver.xml
pop3server.xml
quota.xml
recipientrewritetable.xml
setenv.sh
sieverepository.xml
smtpserver.xml
sqlResources.xml
usersrepository.xml
wrapper.conf

 

Step 5: Start

더보기

Step 5: Start
#############

$ cd bin
$ ./james start 
  * !! you need libc6 installed on Linux !! - sudo apt-get install libc6-i386 libc6-dev-i386 on ubuntu
  * You can see log result in the log/wrapper.log file.

/james/james-server-spring-app-3.7.0/bin$ ./james start

 

Step 6: Create Domains and Users

더보기

Step 6: Create Domains and Users
################################

Time to add domains and users.
We will show how to via the james-cli (client interface).
You also can achieve this via JMX (launch jconsole). JMX has more operations than james-cli.

  * cd bin
  * james-cli -h localhost -p 9999 adddomain mydomain.tld
  * james-cli -h localhost -p 9999 adduser myuser@mydomain.tld mypassword

  * The username to use in your mail client will be myuser@mydomain.tld

 

Step 7: Test

더보기

Step 7: Test
############

$ telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 172.16.1.131 SMTP Server (JAMES SMTP Server 3.0.0) ready Wed, 20 Jul 2017 17:31:33 +0100 (CET)
ehlo test
250-172.16.1.131 Hello test (aoscommunity.com [127.0.0.1])
250-PIPELINING
250-ENHANCEDSTATUSCODES
250 8BITMIME
mail from:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.0 Sender <YOUR_NAME@YOUR_DOMAIN> OK
rcpt to:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.5 Recipient <YOUR_NAME@YOUR_DOMAIN> OK
data
354 Ok Send data ending with <CRLF>.<CRLF>
subject: test

this is a test
.
250 2.6.0 Message received
quit
Connection closed by foreign host.

 

Step 8: Manage

더보기

Step 8: Manage
##############

8.1. Manage via james-cli

  usage: java org.apache.james.cli.ServerCmd --host <arg> <command>
    -h,--host </arg>   node hostname or ip address
    -p,--port </arg>   remote jmx agent port number
  Available commands:
    adduser </username> </password>
    removeuser </username>
    listusers
    adddomain </domainname>
    removedomain </domainname>
    listdomains

8.2. Manage via JMX

  * Launch jconsole (or any other JMX client) and connect on URL=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi
  * Select the MBeans tab and open the org.apache.james node to view attributes and execute operations.

 

Step 9: Monitor

더보기

Step 9: Monitor
###############

  * Monitor the ./log/wrapper.log log file.

  * Monitor via JMX (launch any JMX client and connect to URL=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi)

  * Check ./var folder usage
  
    mail
    +-error
    +-address-error
    +-relay-denied
    +-spam

    store
    +-derby
    +-jackrabbit
    +-activemq
      +-brokers
        +-james
      +-blob-transfer
        +-outgoing
        +-spool

  * Check /tmp folder usage

'기타' 카테고리의 다른 글

DNS 레코드 종류  (0) 2022.03.27
Docker 쌩초보 가이드  (0) 2022.03.13
[Ubuntu] Docker 설치, 제거, 세팅  (0) 2022.03.12
[Ubuntu] netstat, ssh, root password 등 초기 설정  (0) 2022.03.12
톰캣 SSL 보안 인증서 갱신 가이드  (0) 2021.10.23

Address Mapping records (A)

원문 : The record A specifies IP address (IPv4) for given host. A records are used for conversion of domain names to corre sponding IP addresses.

번역 : 레코드 A는 주어진 호스트에 대한 IP 주소(IPv4)를 지정합니다. A 레코드는 도메인 이름을 해당 IP 주소로 변환하는 데 사용됩니다.


IP Version 6 Address records (AAAA)

원문 : The record AAAA (also quad-A record) specifies IPv6 address for given host. So it works the same way as the A record and the difference is the type of IP address.
번역 : AAAA 레코드(쿼드 A 레코드도 포함)는 지정된 호스트에 대한 IPv6 주소를 지정합니다. 따라서 A 레코드와 동일한 방식으로 작동하며 차이점은 IP 주소 유형입니다.


Canonical Name records (CNAME)

원문 : The CNAME record specifies a domain name that has to be queried in order to resolve the original DNS query. Therefore CNAME records are used for creating aliases of domain names. CNAME records are truly useful when we want to alias our domain to an external domain. In other cases we can remove CNAME records and replace them with A records and even decrease performance overhead.
번역 : CNAME 레코드는 원래 DNS 쿼리를 해결하기 위해 쿼리해야 하는 도메인 이름을 지정합니다. 따라서 CNAME 레코드는 도메인 이름의 별칭을 만드는 데 사용됩니다. CNAME 레코드는 도메인의 별칭을 외부 도메인으로 지정할 때 정말 유용합니다. 다른 경우에는 CNAME 레코드를 제거하고 A 레코드로 교체하고 성능 오버헤드를 줄일 수도 있습니다.


Host Information records (HINFO)

원문 : HINFO records are used to acquire general information about a host. The record specifies type of CPU and OS. The HINFO record data provides the possibility to use operating system specific protocols when two hosts want to communicate. For security reasons the HINFO records are not typically used on public servers.
Note: Standard values in RFC 1010

번역 : HINFO 레코드는 호스트에 대한 일반 정보를 얻는 데 사용됩니다. 레코드는 CPU 및 OS 유형을 지정합니다. HINFO 레코드 데이터는 두 호스트가 통신하기를 원할 때 운영 체제 특정 프로토콜을 사용할 수 있는 가능성을 제공합니다. 보안상의 이유로 HINFO 레코드는 일반적으로 공용 서버에서 사용되지 않습니다.
참고: 표준 값RFC 1010

Integrated Services Digital Network records (ISDN)

원문 : The ISDN resource record specifies ISDN address for a host. An ISDN address is a telephone number that consists of a country code, a national destination code, a ISDN Subscriber number and, optionally, a ISDN subaddress. The function of the record is only variation of the A resource record function.
번역 : ISDN 리소스 레코드는 호스트의 ISDN 주소를 지정합니다. ISDN 주소는 국가 코드, 국가 대상 코드, ISDN 가입자 번호 및 선택적으로 ISDN 하위 주소로 구성된 전화 번호입니다. 레코드의 기능은 A 리소스 레코드 기능의 변형일 뿐입니다.


Mail exchanger record (MX)

원문 : The MX resource record specifies a mail exchange server for a DNS domain name. The information is used by Simple Mail Transfer Protocol (SMTP) to route emails to proper hosts. Typically, there are more than one mail exchange server for a DNS domain and each of them have set priority.
번역 : MX 리소스 레코드는 DNS 도메인 이름에 대한 메일 교환 서버를 지정합니다. 이 정보는 SMTP(Simple Mail Transfer Protocol)에서 이메일을 적절한 호스트로 라우팅하는 데 사용됩니다. 일반적으로 DNS 도메인에 대해 둘 이상의 메일 교환 서버가 있으며 각각에 우선 순위가 설정되어 있습니다.


Name Server records (NS)

원문 : The NS record specifies an authoritative name server for given host.

번역 : NS 레코드는 지정된 호스트에 대한 권한 있는 이름 서버를 지정합니다.


Reverse-lookup Pointer records (PTR)

원문 : As opposed to forward DNS resolution (A and AAAA DNS records), the PTR record is used to look up domain names based on an IP address.
번역 : 순방향 DNS 확인(A 및 AAAA DNS 레코드)과 달리 PTR 레코드는 IP 주소를 기반으로 도메인 이름을 조회하는 데 사용됩니다.

 

Start of Authority records (SOA)

원문 : The record specifies core information about a DNS zone, including the primary name server, the email of the domain administrator, the domain serial number, and several timers relating to refreshing the zone.

번역 : 이 레코드는 기본 이름 서버, 도메인 관리자의 이메일, 도메인 일련 번호 및 영역 새로 고침과 관련된 여러 타이머를 포함하여 DNS 영역에 대한 핵심 정보를 지정합니다.


Text records (TXT)

원문 : The text record can hold arbitrary non-formatted text string. Typically, the record is used by Sender Policy Framework (SPF) to prevent fake emails to appear to be sent by you.
번역 : 텍스트 레코드는 형식이 지정되지 않은 임의의 텍스트 문자열을 보유할 수 있습니다. 일반적으로 레코드는 SPF에서 사용자가 보낸 것처럼 보이는 가짜 이메일을 방지하는 데 사용됩니다.





 
http://dns-record-viewer.online-domain-tools.com/

 

DNS Record Viewer - A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT

Online DNS Record Viewer makes it easy to view all kinds of Domain Name System (DNS) records. The DNS is crucial system for today's Internet. Incorrectly set up DNS records cause many different problems to administrators of web servers and company infrastr

dns-record-viewer.online-domain-tools.com

 

1. 기본 용어

Image = class

Layer = Image + α

Container = Image나 Layer의 instant

 

2. docker image 검색 (image 모음)

 

3. docker 기본 명령어 (Image 다운, 목록 보기, 제거 && Container 생성, 실행, 종료, 제거)

더보기

$ docker pull httpd

httpd 이미지 풀 (다운로드)

 

$ docker images

pull한 이미지들 확인

 

$ docker run httpd

httpd 이미지 container생성 후 실행

 

$ docker run -name asdf httpd

httpd 이미지 asdf 이름으로 생성 후 실행

 

6. $ docker stop asdf

asdf 이름 container 정지

 

$ docker start asdf

asdf 이름 container 실행

 

$ docker ps

실행 중 container들 확인

 

$ docker logs -f asdf

asdf 이름 container log출력 (-f : 로그 계속해서 출력하는 옵션)

 

$ docker rm --force asdf

asdf 이름 container 제거 (--force : 컨테이너가 실행중일때 강제로 삭제하는 옵션)

 

$ docker rmi httpd

httpd 이미지 제거

 

4. docker 명령어1 (호스트와 컨테이너 네트워킹 : 포트포워딩, 디렉토리 동기화 연결)

더보기

$ docker run -name asdf -p 9999:80 httpd

-p : [docker 포트 포워딩]호스트(서버) 포트(9999)를 이미지 컨테이너의 포트(80)에 연결(할당)

 

$ docker exec asdf pwd

asdf container의 pwd명령어 실행(pwd)

 

$ docker exec -it asdf /bin/sh (/bin/bash)

asdf container의 쉘 프롬프트 실행, 연결 유지 (연결 해제 시 exit 입력)

 

$ docker run -name asdf -p 9999:80 -v ~/htmls:/usr/local/apaches/htdocs httpd

-v : 호스트의 디렉토리와 컨테이너의 디렉토리 동기화

 

$ docker run -it -name asdf ubuntu bash

-it ~ bash : asdf container를 생성하고 실행 직후 명령 프롬프트까지 실행

 

5. docker 명령어2 (Image Layer 생성)

더보기

$ docker commit asdf asdf-repo:asdf-v1

asdf container를 asdf-v1 테그로 asdf-repo 저장소에 이미지를 생성 [이것을 Layer 라고 함]

 

$ docker run -it -name asdf-v2 asdf-repo:asdf-v1 bash

asdf-repo 저장소의 asdf-v1 이미지로 asdf-v2 container를 생성 후 실행, 프롬프트 실행

 

$ docker commit asdf-v2 asdf-repo:asdf-v2

asdf-v2 container를 asdf-v2 테그로 asdf-repo 저장소에 이미지를 생성 [확장 Layer 를 계속 생성 할 수 있다.]

 

6. docker 명령어3 (Dockerfile로 이미지 생성)

더보기
From ubuntu (Image)
Run apt update && upt install -y git

$ docker build -t asdf-repo:asdf-v3 /Dockerfile경로

 

7. docker 명령어4 (내가 만든 Docker Image를 Docker Hub에 공유)

더보기

$ docker login

Docker hub에 로그인

 

$ docker push docker/mobytheewhale/my-first-repo:tagname

로그인 한 계정의 저장소에 이미지를 업로드

[설치 가이드 요약]

더보기

1. 이전 버전 제거 

$ sudo apt-get remove docker docker-engine docker.io containerd runc

 

2. apt 패키지 인덱스를 업데이트하고 apt가 HTTPS를 통해 리포지토리를 사용할 수 있도록 패키지를 설치합니다.

$ sudo apt-get update

$ sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

 

3. Docker의 공식 GPG 키 추가:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

 

4. 다음 명령어를 사용하여 안정적인 저장소를 설정합니다. 

nightly 또는 테스트 리포지토리를 추가하려면 아래 명령에서 단어 뒤에 nightlyor test(또는 둘 다)를 추가합니다.

$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

 

5. apt패키지 인덱스를 업데이트하고 최신 버전 의 Docker Engine을 설치합니다.

$ sudo apt-get update

$ sudo apt-get install docker-ce docker-ce-cli containerd.io


6. hello-world 이미지 를 실행하여 Docker 엔진이 올바르게 설치되었는지 확인하십시오 .

$ sudo docker run hello-world

이 명령은 테스트 이미지를 다운로드하고 컨테이너에서 실행합니다. 컨테이너가 실행되면 메시지를 인쇄하고 종료합니다.

 

[제거 가이드 요약]

더보기

1. Docker 엔진, CLI 및 Containerd 패키지를 제거합니다.

$ sudo apt-get purge docker-ce docker-ce-cli containerd.io

 

2. 호스트의 이미지, 컨테이너, 볼륨 또는 사용자 지정 구성 파일은 자동으로 제거되지 않습니다. 모든 이미지, 컨테이너 및 볼륨을 삭제하려면:

$ sudo rm -rf /var/lib/docker
$ sudo rm -rf /var/lib/containerd

 

[설치 후 세팅 요약]

더보기

1. 루트가 아닌 사용자로 Docker 관리

docker 그룹을 추가하고 현재 유저를 그룹에 포함시킵니다. 그 후 docker 그룹의 구성원을 확인합니다.

$ sudo groupadd docker

$ sudo usermod -aG docker $USER

$ sudo cat /etc/group | grep docker

로그아웃했다가 다시 로그인하여 그룹 구성원 자격을 재평가하십시오.

$ docker run hello-world

가상 머신에서 테스트하는 경우 변경 사항을 적용하려면 가상 머신을 다시 시작해야 할 수 있습니다. X Windows와 같은 데스크톱 Linux 환경에서는 세션에서 완전히 로그아웃한 다음 다시 로그인합니다. Linux에서는 다음 명령을 실행하여 그룹에 대한 변경 사항을 활성화할 수도 있습니다.

$ newgrp docker

 

2. 부팅 시 시작하도록 Docker 구성

대부분의 최신 Linux 배포판(RHEL, CentOS, Fedora, Debian, Ubuntu 16.04 이상) systemd은 시스템 부팅 시 시작되는 서비스를 관리하는 데 사용합니다. Debian 및 Ubuntu에서 Docker 서비스는 기본적으로 부팅 시 시작되도록 구성됩니다. 다른 배포판의 부팅 시 Docker 및 Containerd를 자동으로 시작하려면 아래 명령을 사용하십시오.

$ sudo systemctl enable docker.service
$ sudo systemctl enable containerd.service

이 동작을 비활성화하려면 disable을 사용하십시오.

$ sudo systemctl disable docker.service
$ sudo systemctl disable containerd.service

 

 

[Docker Guide Home]

https://docs.docker.com/engine/install/ubuntu/

 

Install Docker Engine on Ubuntu

 

docs.docker.com

 

'기타' 카테고리의 다른 글

[Ubuntu] Apache James 3.7.0 설치  (0) 2022.03.27
DNS 레코드 종류  (0) 2022.03.27
Docker 쌩초보 가이드  (0) 2022.03.13
[Ubuntu] netstat, ssh, root password 등 초기 설정  (0) 2022.03.12
톰캣 SSL 보안 인증서 갱신 가이드  (0) 2021.10.23

1. netstat 설치

$ sudo apt-get install net-tools

 

2. ssh 포트 변경

$ sudo vi /etc/ssh/sshd_config
...
#Port 22 -> 주석 제거, 번호 변경
...
$ sudo service sshd restart

 

3. root 접속

$ sudo passwd

...

$ su -

...

 

4. root 쉘 프롬프트 색 변경

$ sudo vi /root/.bashrc

...

#force_color_prompt=yes -> 주석 제거

...

'기타' 카테고리의 다른 글

[Ubuntu] Apache James 3.7.0 설치  (0) 2022.03.27
DNS 레코드 종류  (0) 2022.03.27
Docker 쌩초보 가이드  (0) 2022.03.13
[Ubuntu] Docker 설치, 제거, 세팅  (0) 2022.03.12
톰캣 SSL 보안 인증서 갱신 가이드  (0) 2021.10.23

걍 버전 안맞아 그런거..

 

create-react-app 새로 설치 해주자..

 

npm uninstall -g create-react-app
npm install -g create-react-app

 

하기 내용은 콘솔 프린트 전문

더보기

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

 

링크

https://create-react-app.dev/docs/getting-started/

 

Getting Started | Create React App

Create React App is an officially supported way to create single-page React

create-react-app.dev

대충 react app을 init이나 create 하는 방법을 알려준다

1. openssl 설치
 - 다운로드 Link http://slproweb.com/products/Win32OpenSSL.html
 - 환경변수 설정 

2. pfx 파일 생성
 - 준비물 : key file, Root 인증서, Chain 인증서, 사이트 인증서, 인증서 비밀번호
 - 명령어 : openssl pkcs12 -export -out [생성파일 경로.pfx] -inkey [key file 경로] -in [사이트 인증서 경로] -certfile [Chain 인증서 경로] -certfile [Root 인증서 경로] -name [사이트 주소]

 - 예 :

openssl pkcs12

-export -out C:\Users\gillilo\Desktop\test\test.pfx

-inkey C:\Users\gillilo\Desktop\test\test.com_key.pem

-in C:\Users\gillilo\Desktop\test\File_test.com_apache.crt

-certfile C:\Users\gillilo\Desktop\test\ChainFile_ChainBundle.crt

-certfile C:\Users\gillilo\Desktop\test\CA_GLOBALSIGN_ROOT_CA.crt

-name test.com

 - 기타 : .keystore 파일이나 .pfx 파일을 받은경우 바로 업로드하여 사용하면 됨

 

3. .pfx 인증서 서버 업로드

 

4. 톰캣 server.xml 변경

<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               keystoreFile=".pfx 인증서 경로" keystorePass=".pfx 인증서 비밀번호" keystoreType="PKCS12"
               clientAuth="false" sslProtocol="TLS" />

 - 기타 : .pfx 파일인 경우에만 keystoreType="PKCS12" 기입 .keystore 일때는 X

5. 톰캣 재시작

 

6. 인증서 확인

'기타' 카테고리의 다른 글

[Ubuntu] Apache James 3.7.0 설치  (0) 2022.03.27
DNS 레코드 종류  (0) 2022.03.27
Docker 쌩초보 가이드  (0) 2022.03.13
[Ubuntu] Docker 설치, 제거, 세팅  (0) 2022.03.12
[Ubuntu] netstat, ssh, root password 등 초기 설정  (0) 2022.03.12

pgadmin4로 튜닝하는 방법이다.

여기 row 19,233의 duration 15secs 짜리 쿼리가 있다.

작성한 쿼리를 돌려볼때는 흔히 

쿼리 에디터에서 F5할것이다.

pgadmin은 Explain Analyze 기능을 제공하는데 이 기능은 쿼리의 어느부분이 느린건지 설명해주는 거라 보면 된다.

위에 색칠된 가로 화살표는 쿼리를 실행하는 버튼이고 네모난 아이콘은 분석하는 버튼이다.

분석버튼의 옆 아래화살표를 클릭하면 어떤 항목을 분석할건지 선택 가능하다.

보통 전부 체크하는편이다.

 

F7로 실행을 해보면 pgadmin 밑부분에 쿼리에 대한 설명이 나온다.

Grphical은 옵티마이저가 어떤 내비게이션 경로를 선택했는지 이미지로 보여준다.

 

Statistics는 쿼리의 어떤 부분이 얼마나 쿼리의 비중을 차지하는지 통계해준다.

왼쪽의 Statistics per Node Type은 Sort나 Join 등 Table 스캔 외적인 부분이고

오른쪽의 Statistics Per Table은 Table 스캔에 들어가는 비용이라 할수있다.

 

Statistics per Node Type 부분을 보면 메모리 튜닝으로 설정의 어떤 설정값을 수정해야 할지 대략적으로 알게되고,

(혹은 HW 업그레이드)

Statistics Per Table 부분을 보면 Index 튜닝을 어떤 테이블에 해야할지 대략적으로 알게된다.

(혹은 정규화, 비정규화 등 table 튜닝)

 

마지막으로 Analysis는 쿼리의 실행 부분들을 단편적으로 쪼개서 분석해논 것이다.

화면에 대한 설명은 아래 링크를 타고 들어가서 확인하면 된다.

https://explain.depesz.com/help

 

Help | explain.depesz.com

explain.depesz.com PostgreSQL's explain analyze made readable new explain history help about contact Help explain.depesz.com is a tool for finding real causes for slow queries. Generally, one would use the EXPLAIN ANALYZE query; and read the output. The pr

explain.depesz.com

보통 우리가 보는 부분은 Exclusive가 배경색이 있는 행들이다.

해당 행이 Scan 부분이 아니면 상위행의 Buckets, Batches, Memory Usage 부분을 보고

Memory 튜닝, Table 튜닝을 하면 되고,

테이블 Scan 부분이면 Filter, Rows Removed by Filter 부분을 보고 Index 튜닝을 하면 된다.

 

'PostgreSQL' 카테고리의 다른 글

PostgreSQL 메모리 설정을 쉽게  (0) 2021.10.23
pgAdmin (PostgreSQL Management Tool)  (0) 2021.02.14
PostgreSQL Downloads (DB 다운로드)  (0) 2021.02.14

+ Recent posts