Giter Site home page Giter Site logo

development-process's People

Watchers

 avatar

Forkers

chosam2

development-process's Issues

다중 접속 프로토콜(multiple access protocol) / ARP / Ethernet / ICMP / Routing algorithm

(1) 다중 접속 프로토콜이란?

   노드가 채널을 공유하는 방법 – 예를 들어 전송 시점 등 –을 결정하는 분배 알고리즘

(2) 크게 3가지로 분류되는 다중 접속 프로토콜의 종류와 동작을 간략히 기술

채널 분할 프로토콜(channel partition protocol)은 채널은 더 작은 “조각”들로 분할 (시간 슬롯, 주파수, 코드)되고 할당된 조각들은 노드가 배타적으로 사용 ==> 고비용

  • 채널 분할 프로토콜은 고정된 길이의 시간 슬롯으로 분할되는 TDMA (Time Division Multiple Access)
    ==> 시간을 조각내서 하나의 단말만 통신, 안전한 방법이지만 고비용 이기 때문에 상황에 따라 사용

  • 채널 스펙트럼이 주파수 밴드(frequency band)로 분할되는 FDMA (Frequency Division Multiple Access)

  • 코드로 분할되는 CDMA (Code Division Multiple Access) 등이 있다.

랜덤 접속 프로토콜(random access protocol)은 채널은 분할하지 않고 충돌 허용하고 충돌 시 복구
==> 충돌이 발생 함에도 감수하고 사용 (값이 싸기 때문)

  • 슬롯 제한이 없는 알로아( Pure (unslotted) Aloha )
    ==> 가장 단순한 프로토콜/ 섬과 섬 통신하는데 사용하였는데, 주변상황 신경 쓰지 않고 통신 겹치는 시간이 있다면 frame(2계층에서의 메시지) 끼리 충돌이 일어남, 바쁠때는 더욱 심한 충돌 발생

  • 랜덤 접속 프로토콜은 같은 크기의 슬롯의 시작점에서만 프레임을 전송하는 슬롯 알로아(Slotted Aloha)
    ==> 보낼 frame을 눈치 보지 않고 보내긴 하는데 시작 시간만 정해져 보내자, 충돌이 일어나긴 하지만 pure 보다 더 적은 충돌 확률

  • 전송 전에 채널의 사용 여부를 조사하는 캐리어 감지를 하여 채널이 쉬고 있을 때 전송하는 CSMA (Carrier Sense Multiple Access) 프로토콜 등이 있다.
    ==> 규칙등장, 다른 frame 이 전송될때 잠시 양보 하고 대기 후 전송 시작 , 충돌 확률은 훨씬 더 줄지만 100% 막지는 못함

순번 프로토콜 (taking-turns protocol)은 노드가 순번대로 채널을 사용하고 더 많은 데이터를 전송하는 노드는 오랫동안 순번을 기다려야 함

  • 순번 프로토콜에는 마스터 노드가 슬레이브 노드에게 차례로 전송하도록 지정하는 폴링 프로토콜(polling protocol)과 토큰이 순서대로 노드들에게 전달되어 순서를 지정하는 토큰 전달 프로토콜(token-passing protocol) 등이 있다.

git commit 기록 삭제( reset, revert 이용) / git 저장소 이동

reset


- reset 명령어를 이용하면 더 이상 필요 없어진 커밋들을 버릴 수 있습니다. 
명령어 실행 시 어떤 모드로 실행할 지 지정하여 'HEAD' 위치와 인덱스, 
작업 트리 내용을 함께 되돌릴지 여부를 선택할 수 있습니다.

커밋만 되돌리고 싶을 때 (soft)
변경한 인덱스의 상태를 원래대로 되돌리고 싶을 때 (mixed)
최근의 커밋을 완전히 버리고 이전의 상태로 되돌리고 싶을 때 (hard)

ex) git reset --hard c1012ba  (최근 커밋을 완전히 버리고 해당 커밋으로 이동)
git push -f (최근 커밋기록 다 지우고 덮어씀)

ex) git reset HEAD^ : 최종 커밋을 취소. 워킹트리는 보존됨. (커밋은 했으나 push하지 않은 경우 유용)

revert

- revert 명령어를 이용하면, 특정 커밋의 내용을 삭제할 수 있습니다. rebase -i 명령어나 reset 명령어를 통해 커밋을 삭제할 수도 있지만, 해당 커밋이 이미 공개된 상태인 경우에는 이러한 삭제 작업을 함부로 하기 어렵습니다. 이러한 경우에는 revert 명령어를 이용해서 특정 커밋의 내용을 지우는 새로운 커밋(B')을 만들어 보다 안전하게 처리할 수 있습니다.

Java Inner

Inner Class (내부 클래스)

  • 자바 이너 클래스 혹은 중첩 클래스는 하나의 클래스로, 클래스나 인터페이스 내부에서 선언
  • 코드를 더읽기 쉽고, 더 유지하기 위해, 논리적인 그룹과 인터페이스들에서 이너클래스를 사용

장점

  1. 중첩 클래스는 개인적인 것을 포함하는 외부 클래스의 모든 멤버(데이터 멤버와 메소드등)에 접근할수 있다는 관련성의 특별한 타입을 나타냄
  2. 중첩 클래스의 논리 그룹 클래스와 인터페이스 내부에 있기 때문에 더 읽기 쉽고, 유지 가능한 코드 개발에 사용
  • 이너 클래스오 중첩 클래스의 차이 :
    => 이너 클래스는 중첩 클래스의 한 부분
    => 중첩 클래스는 2가지 타입으로 나뉘는데 정적 중첩 클래스와 동적 중첩 클래스로 나뉨
    => 여기서 정적 중첩 클래스는 이너클래스
  1. 코드 최적화: 작성하는데 더 적은 코드가 요구

참고 : https://tworab.tistory.com/49

ab 벤치마킹

옵션

-t : 호출 시간 limit
-c : 동시 호출할 client 수
-n : 호출할 request 횟수
호출 예
ab -n 100 -c 2 http://test.com/ => 2개 클라이언트가 총 100회 호출
ab -t 10 -c 2 http://test.com/ => 2개 클라이언트가 10초 동안 호출

벤치마킹 받는 서버(컴퓨터)에서 top 이라는 명령어를 통해서 cpu 점유율을 확인할수 있음
$ top
아파치 웹서버 접속자 로그 확인 명령
$ sudo tail -f /var/log/apache2/access.log

주요 결과

Time take for tests : 테스트 수행시간 (요청에 대해서 처리한 총 시간)
Requests per second : 초당 요청 처리 횟수 ( 1초당 몇번 처리할수 있었는지)
Time per request : 요청 당 응답 시간 ( ms 나온 결과값에 1/1000 곱하면 1초로 계산됨) ==> 보통 1초 가 넘지 않으면 좋은 서비스 

예)
[]# ab http://www.naver.com/
This is ApacheBench, Version 1.3d <$Revision: 1.69 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.naver.com (be patient).....done
; 아파치 버전

Server Software: Apache
; 도메인명

Server Hostname: www.naver.com
; 웹서비스 사용 포트

Server Port: 80

; 초기문서가 위치하는 웹문서 root(서버내의 절대경로가 아님)

Document Path: /
; 초기문서의 용량

Document Length: 72226 bytes

Concurrency Level: 1
; 응답속도(사실 이값만 확인하면 된다.)

Time taken for tests: 0.016 seconds
; 요구에 응답한 세션수

Complete requests: 1
; 요구에 응답실패한 세션수

Failed requests: 0
; 실패한 에러수

Broken pipe errors: 0
; 총 전송 바이트수

Total transferred: 72539 bytes
; 총 전송한 HTML 바이트수

HTML transferred: 72226 bytes
; 초당 응답요구수

Requests per second: 62.50 [#/sec] (mean)
; 요구에 응답한 시간 (이값도 중요하다)

Time per request: 16.00 [ms] (mean)
; 요구에 응답한 시간

Time per request: 16.00 [ms] (mean, across all concurrent requests)
; 초당 전송 가능한 용량

Transfer rate: 4533.69 [Kbytes/sec] received

VSCode

  • 단축키 정리
    control + ` ==> 내장 터미널 open
    control + c ==> 실행 종료

2018-08-27 9 03 12

  • 디버깅 방법

  • auto completion 설치하기

오라클 reorg, shrink, move ( 테이블 스페이스 공간 확보 )

참고 : https://positivemh.tistory.com/350

스크린샷 2019-09-19 오후 9 16 51

HWM( High Water Mark )

  • 마지막까지 등록된 볼록 위치
  • 데이터가 대량으로 지워지면 이전에 표시되었던 HWM은 그대로이고 실재로 사용되는 데이터는
    HWM보다 훨씬 작음
  • 데이터 조회시(Full Scan 등) HWM 표시부분까지 읽기 때문에 불필요한 I/O 발생
  • 사용하지 않는 공간이 많으면 공간낭비 뿐 아니라 조회 성능이 떨어지는 문제도 발생

스크린샷 2019-09-19 오후 9 20 37

용량 확인 
SELECT SEGMENT_NAME, BLOCKS, bytes/1024/1024 MB 
FROM DBA_SEGMENTS
실제 사용 블록확인 
SELECT COUNT(DISTINCT 
DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)||
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)) "USED"
FROM ____;

블록의 크기와 실제 사용블록의 크기가 차이가 많이 나면 HWM를 줄여주는 것이 좋음

1. SHRINK

SHRINK 제약사항

  • UNDO SEGMENTS
  • TEMPORARY SEGMENTS
  • CLUSTERED TABLE
  • TABLE WITH A COLUMN OF DATATYPE LONG
  • LOB INDEXES
  • IOT MAPPING TABLES AND IOT OVERFLOW SEGMENTS
  • TABLES WITH MVIEWS WITH ON COMMIT
  • TABLES WITH MVIEWS ARE BASED ON ROWIDS
  • Function Base Index
  • nologging, parallel 수행 안됨
  • 대용량 테이블일 경우 속도가 느리다.

shrink 작업 대상이 되는 테이블 찾기

   1] SHRINK 대상 테이블 분석 및 조회
      (NUM_ROWS에 비해 사용하는 BLOCKS가 과다하면 SHRINK필요)

      SQL> SELECT OWNER,     TABLE_NAME,   NUM_ROWS,
                  BLOCKS,    EMPTY_BLOCKS, AVG_SPACE,
                  CHAIN_CNT, AVG_ROW_LEN
             FROM DBA_TABLES
            WHERE OWNER = '소유자'
              AND EMPTY_BLOCKS / (BLOCKS + EMPTY_BLOCKS) < 0.1
              AND (BLOCKS + EMPTY_BLOCKS) > 0
            ORDER BY BLOCKS DESC;
      [참고] DBMS_SPACE.VERIFY_SHRINK_CANDIDATE

SQL > select job_name, program_name
from dba_scheduler_jobs
where job_name like '%SPACE%';

SQL > select program_name, program_action
from dba_scheduler_programs
where program_name = 'AUTO_SPACE_ADVISOR_PROG';

SELECT * FROM TABLE(dbms_space.asa_recommendations());

shrink 실행 ( 두 단계에 걸쳐 이루어 짐)

  1. 데이터의 compact : HWM 아래 영역에 중간 중간 hole을 채우는 작업 / HWM은 변하지 않음

  2. HWM 내리기 : 1번 단계 후 새롭게 설정된 HWM 이후의 모든 공간을 해당 테이블 스페이스로 반납

$ ALTER TABLE ____ ENABLE ROW MOVEMENT; // row-movement 활성화 후 사용 가능
$ ALTER TABLE ____ SHRINK SPACE COMPACT// HWM 줄지 않고 중간중간 데이터 빈 공간 compact 
==> shrink space 하기전 compact 하는게 속도 향상 가능
$ ALTER TABLE ____ SHRINK SPACE // 테이블 
$ ALTER TABLE ____ SHRINK SPACE CASCADE // 테이블의 인덱스  cascade ;
$ ALTER TABLE ____ DISENABLE ROW MOVEMENT; // 비활성화 

2. ALTER TABLE MOVE 실행

- move용 임시 테이블 스페이스 생성
$ CREATE TABLESPACE MOVE_IMSI DATAFILE '/oracle/app/oracle/oradata/movets01.dbf' SIZE 1G;

**테이블 기능 LOGGING 기능 OFF ( 운영서버에서는 NOLOGGING 권장안함 )**
NOLOGGING 후 insert 빨리해서 백업 하기 위함 (테스트 개발서버에서 진행)
$ ALTER TABLE 테이블이름 NOLOGGING;
$ ALTER TABLE 테이블이름 LOGGING;

- 테이블 새로 생성한 테이블 스페이스로 테이블 move
$ ALTER TABLE HWMTEST2 MOVE TABLESPACE MOVE_IMSI;

 - 인덱스 상태 조회 ( INDEX_NAME 조회)
SELECT TABLE_NAME, INDEX_NAME, STATUS 
FROM DBA_INDEXES
WHERE TABLE_NAME = 'HWMTEST2';

- 인덱스 상태가 UNUSABLE 이기 때문에 rebuild 진행!
ALTER INDEX (INDEX_NAME) REBUILD;
  • 인덱스 리빌드 이유!
    => Table 의 index 컬럼에 update와 잦은 delete 시 index data는 지워지지 않으며 오라클 내부적으로 현재 이 인덱스 데이터는 삭제된 것이다라는 마킹만 해놓기 때문
    삭제 되었다 마킹된 부분은 공간을 재활용 할 필요가 있음

git commit 100MB이상 파일 지우기(bfg repo-cleaner사용)

https://rtyley.github.io/bfg-repo-cleaner/

HEAD의 마지막 Commit에는 100MB가 넘는 파일이 없더라도 이전 Commit 중에 100MB 이상의 파일이 포함된 적이 있다면 이 경고를 피할 수 없다.

$ git push
Counting objects: 3086, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2980/2980), done.
Writing objects: 100% (3086/3086), 363.25 MiB | 935.00 KiB/s, done.
Total 3086 (delta 1236), reused 111 (delta 57)
remote: error: GH001: Large files detected. You may want to try Git Large File Storage — https://git-lfs.github.com.
remote: error: Trace: ***
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File *** is 120.94 MB; this exceeds GitHub’s file size limit of 100.00 MB
To [email protected]:***
 ! [remote rejected] master -> master (pre-receive hook declined)
 ! [remote rejected] *** -> *** (pre-receive hook declined)
error: failed to push some refs to ‘[email protected]:***’

iterms2 / zsh / fzf

관련 링크 : https://subicura.com/2017/11/22/mac-os-development-environment-setup.html

iterms2

  • macOS에 기본으로 설치되어 있는 Terminal 앱 대신 iTerm2를 터미널 앱으로 사용합니다. iTerm2는 기본 앱에 없는 다양한 기능이 있고 손쉽게 테마를 설정

$ brew cask install iterm2

macOS는 기본으로 Bash(Bourne-again) shell을 사용하고 있습니다. bash외에 csh, ksh, sh, tcsh, zsh등을 내장하고 있는데 최근 대새는 단연 zsh입니다. zsh에 설정 관리 프레임워크인 oh-my-zsh을 사용하여 이쁜 테마를 적용하고 여러 가지 플러그인을 설치해봅니다.

$ brew install zsh zsh-completions

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" // zsh의 설정을 관리해주는 oh-my-zsh을 설치합니다.

2018-08-28 6 31 55

세션클러스터링 (톰캣 서버) // Nginx (로드밸런싱)

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--><!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 --><Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine defaultHost="localhost" name="Catalina">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
        
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
      	<Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/>

    	<Channel className="org.apache.catalina.tribes.group.GroupChannel">
        <Membership className="org.apache.catalina.tribes.membership.McastService"
                    address="228.0.0.4"
                    port="45564"
                    frequency="500"
                    dropTime="3000"/>
        <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                  address="auto"
                  port="4000"
                  autoBind="100"
                  selectorTimeout="5000"
                  maxThreads="6"/>

        <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
            <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
        </Sender>
        <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
        <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
    	</Channel>

    	<Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
    	<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

    	<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
            tempDir="/tmp/war-temp/"
            deployDir="/tmp/war-deploy/"
            watchDir="/tmp/war-listen/"
            watchEnabled="false"/>

    	<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
      	
      </Cluster>
      

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>

      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>

      <Context docBase="2018-cap1-4" path="/home" reloadable="true" source="org.eclipse.jst.jee.server:2018-cap1-4"/></Host>
    </Engine>
  </Service>
</Server>
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--><!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 --><Server port="12005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector connectionTimeout="20000" port="8088" protocol="HTTP/1.1" redirectPort="8443"/>
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="12009" protocol="AJP/1.3" redirectPort="8443"/>


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine defaultHost="localhost" name="Catalina">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      
       
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
      	<Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/>

    	<Channel className="org.apache.catalina.tribes.group.GroupChannel">
        <Membership className="org.apache.catalina.tribes.membership.McastService"
                    address="228.0.0.4"
                    port="45564"
                    frequency="500"
                    dropTime="3000"/>
        <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                  address="auto"
                  port="4001"
                  autoBind="100"
                  selectorTimeout="5000"
                  maxThreads="6"/>

        <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
            <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
        </Sender>
        <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
        <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
    	</Channel>

    	<Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
    	<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

    	<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
            tempDir="/tmp/war-temp/"
            deployDir="/tmp/war-deploy/"
            watchDir="/tmp/war-listen/"
            watchEnabled="false"/>

    	<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
      	
      </Cluster>
      

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>

      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>

      <Context docBase="2018-cap1-4" path="/home" reloadable="true" source="org.eclipse.jst.jee.server:2018-cap1-4"/></Host>
    </Engine>
  </Service>
</Server>
<!-- web.xml WAS Session Clustering -->
	<distributable/>
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    
    upstream balancer {
        least_conn;
        server localhost:8080;
        server localhost:8088;
    }
    
    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log main;
        
        location /home {
            proxy_pass              http://balancer;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        Host $http_host;
        }

        
        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

react.js

$ npm install -g create-react-app ( use create-react-app developed by facebook)

$ create-react-app react-test ( create project
$ cd react-test

react-test/
  README.md
  node_modules/     # 이미 modules가 설치되어 있습니다.
  package.json      # 의존성 패키지는 대부분 node_modules/react-scripts 모듈내에 선언되어 있습니다.
  .gitignore
  public/
    favicon.ico
    index.html
    manifest.json
  src/
    App.css
    App.js
    App.test.js
    index.css
    index.js        # 앱이 시작되는 부분입니다.
    logo.svg
    registerServiceWorker.js    # prodution 레벨에서 로컬캐시로부터 리소스를 제공하기 위한 서비스 워커 관련 설정,

$ npm start

Mongo DB

show dbs - 전체 데이터베이스 열람
use [DB 이름] - 데이터베이스 선택 (없으면 데이터베이스 생성)
예) use dave_db - dave_db 데이터베이스 선택
show collections - 선택된 데이터베이스의 콜렉션 열람
db.[Collection 이름].함수() 로 해당 컬렉션의 데이터 열람 및 조작
예) db.test.find() - test 컬렉션에서 전체 Document 검색
데이터베이스 생성
use dave_db
데이터베이스 현황 확인
db
db.stats()
데이터베이스 삭제 및 생성
db.dropDatabase() (현재 컬렉션 삭제)
use dave_db
collection 생성 및 삭제
db.createCollection("employees", {capped:true, size:10000})
Right-click (server) -> Click Refresh -> Go to dave_db -> Go to Collections -> Check employees
capped:true 최초 제한된 크기로 생성된 공간에서만 데이터를 저장하는 설정 (고성능, 저장공간차면 기존 공간 재사용, 일정시간만 저장하는 로그에 적합)
db.employees.isCapped()
db.employees.drop()
db.createCollection("employees")
db.employees.isCapped()
db.employees.drop()
db.createCollection("employees", {capped:true, size:10000})
collection 확인
show collections
db.employees.stats()
collection 이름 변경
db.employees.renameCollection("emp")
collection 삭제
db.emp.drop()
alias mongod='brew services run mongodb-community'
alias mongod-status='brew services list'
alias mongod-stop='brew services stop mongodb-community'

커맨드 명령어 정리 ( 유닉스/ 리눅스/ 맥)

whoami

  • 계정명 확인

which

  • 설치 경로 확인
    $ which python3

man

  • 명령어 도움말 확인
    $ man ls // ls 명령어에 대한 도움말 출력

pwd

  • 현재 디렉토리 경로 확인

mkdir/ rm

  • 디렉토리 생성 삭제
    -r : 하위 디렉토리 삭제 / -f : 강제로 삭제

lsof ( list open filse )

  • 시스템에서 열린 파일 목록 알림 및 프로세스 파일 종류 정보 출력
  • 리눅스, 유닉스, 맥

touch

  • 파일 생성

wc

$ wc -l test.txt // 라인수 count

| ( Pipe)

  • 명령의 결과를 다음 명령으로 넘김
    $ ls -al | wc -l // ls 명령어의 라인수를 count

tar

  • 파일을 묶어줌
    c: 파일을 묶어줌
    v: 작업과정 확인
    f: 저장될 파일명 지정

find

grep

chmod

참고 : https://www.lesstif.com/pages/viewpage.action?pageId=20776078

위경도 거리 계산 알고리즘

package com.example.demo.redis;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Optional;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
class PersonRepositoryTest {

    @Autowired
    private PersonRepository repo;

    @Test
    void test() {
        Person person = new Person("FF:124","Kaven", 25, "FF");

        //repo.save(person);

        // 저장
        Iterable<Person> mm = repo.findAllByType("MM");

        mm.forEach(next -> {
            System.out.println(next.getId());
            System.out.println(next.toString());
        });


//        // 삭제
        //repo.delete(person);
    }

    @Test
    void test2() {
        System.out.println(distance(37.55941851781025, 37.45090270958281, 126.98987242188554, 126.70490404042661));

        //37.55941851781025, 126.98987242188554
        //37.45090270958281, 126.70490404042661

        System.out.println(distance_Between_LatLong(37.55941851781025,126.98987242188554,37.45090270958281, 126.70490404042661));

        System.out.println(distance_test3(37.55941851781025,126.98987242188554,37.45090270958281, 126.70490404042661, "K"));

    }

    double distance(double lat1, double lat2, double lon1, double lon2)
    {
        // The math module contains a function
        // named toRadians which converts from
        // degrees to radians.
        lon1 = Math.toRadians(lon1);
        lon2 = Math.toRadians(lon2);
        lat1 = Math.toRadians(lat1);
        lat2 = Math.toRadians(lat2);

        // Haversine formula
        double dlon = lon2 - lon1;
        double dlat = lat2 - lat1;
        double a = Math.pow(Math.sin(dlat / 2), 2)
                + Math.cos(lat1) * Math.cos(lat2)
                * Math.pow(Math.sin(dlon / 2),2);

        double c = 2 * Math.asin(Math.sqrt(a));

        // Radius of earth in kilometers. Use 3956
        // for miles
        double r = 6371;

        // calculate the result
        return(c * r);
    }
    // Points will be converted to radians before calculation
    double distance_Between_LatLong(double lat1, double lon1, double lat2, double lon2) {
        lat1 = Math.toRadians(lat1);
        lon1 = Math.toRadians(lon1);
        lat2 = Math.toRadians(lat2);
        lon2 = Math.toRadians(lon2);

        double earthRadius = 6371; //Kilometers
        return earthRadius * Math.acos(Math.sin(lat1)*Math.sin(lat2) + Math.cos(lat1)*Math.cos(lat2)*Math.cos(lon1 - lon2));
    }

    private static double distance_test3(double lat1, double lon1, double lat2, double lon2, String unit) {
        if ((lat1 == lat2) && (lon1 == lon2)) {
            return 0;
        }
        else {
            double theta = lon1 - lon2;
            double dist = Math.sin(Math.toRadians(lat1)) * Math.sin(Math.toRadians(lat2)) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.cos(Math.toRadians(theta));
            dist = Math.acos(dist);
            dist = Math.toDegrees(dist);
            dist = dist * 60 * 1.1515;
            if (unit.equals("K")) {
                dist = dist * 1.609344;
            } else if (unit.equals("N")) {
                dist = dist * 0.8684;
            }
            return (dist);
        }
    }

}

클라우드 / Docker / 엣지 컴퓨팅!!

클라우드 컴퓨팅

  • 인터넷 상의 서버를 통해서 데이터를 저장해 놓으면 언제 어디서든 사용가능하도록
    it 서비스 제공해주는 것
  • 기업의 경우 방대한 데이터를 관리하는 것이 힘듬 / 따라서 삼성sds는 어떤 클라우드 사용하면 좋을지(컨설팅), 구축, 운영까지 서비스해주면 기업은 적은비용으로 효율적으로 주력사업에만 집중할수 있음
  • 현재 선진국에 비해 기업들의 클라우드 전환 비율이 높지 않기 때문에 앞으로 클라우드 서비스가 필요로 하는기업이 많아질 것
  • 삼성 계열사 클라우드 전환을 도맡아 온 경험을 바탕으로 다른 기업도 진출 중

프라이빗 클라우드

  • 특정 기업만을 위한 클라우드 환경을 구축해주고 운영해주는 것
  • 보안 높지만 비용이 높음

퍼블릭 클라우드

  • 클라우드 제공 업체가 만든 환경을 다수 기업이나 개인이 빌려쓰는 것을 말함
  • 경제적이고 개발시간을 단축시킬수 있음

클라우드 컴퓨팅 서비스 유형

Iaas(Infrastructure as a Service) : 인프라 서비스

  • 인터넷을 통해 서버와 스토리지 등 데이터 센터 자원을 빌려 쓸수 있는 서비스
  • 서버 자원( cpu / 메모리 / 디스크 등 ) : 순수 하드웨어만 가상화 하여 제공
  • ex ) 아마존 aws ec2

Paas ( Platform as a Service) : 플랫폼 서비스

  • 소프트웨어 서비스를 개발할때 필요한 플랫폼을 제공하는 서비스

Sass ( Software as a Service) :

  • 클라우드 환경에서 운영되는 애플리케이션 서비스
  • ex) goole drive, MSOffice

클라우드 구축하기 위한 요소기술에 가상화 기술과 도커와 같은 컨테이너기반 기술이있다.

가상화

컨테이너

[DB] mysql - 초기설정, 권한, 명령어 정리

컬럼명 변경

  • ALTER TABLE 테이블명 CHANGE 기존컬럼명 새컬럼명 기존자료형

컬럼 자료형 변경

  • ALTER TABLE 테이블명 CHANGE 컬럼명 컬럼명 새자료형
    ( ex) alter table schedule change seq seq datetime;

Auto_increment 설정값 초기화

  • ALTER TABLE 테이블명 AUTO_INCREMENT=시작할 값

[Java] static / final 정리

# final

  • 변수 선언 : 선언된 변수는 값만 초기화 할수 있고, 그 값의 변경 및 새로운 할당이 불가능한 상수가 됨(반드시 초기화)
  • 클래스 선언 : 클래스 앞에 선언시 상속 불가능한 클래스
    => final은 상속 불가를 나타내기 때문에 상속이 필수적인 abstract 추상클래스와 함께 사용 못함
  • 메소드 : 메소드 앞 선언시 메소드 포함된 클래스를 상속받은 클래스에서 오버라이딩을 통한 재정의 할수 없음

# static

  • static이 붙은 변수는 클래스의 모든 객체가 공유 가능하고 클래스 변수라고 부름
    => 다른 클래스에서 접근하려는 경우, static 변수가 존재하는 클래스 명 뒤에 점 (.) 을 찍고 static 변수의 명을 써주면 접근 가능
  • 메소드 : 클래스 메소드라고 불리며 어느 객체의 내용에도 의존적이지 않은 하나의 작업을 수행
    => static 선언된 메소드 오버라이딩 되지 않고 상속받은 클래스에서 사용 불가능
  • static 초기화 블록 : main() 메소드보다 먼저 수행
static {
 // 초기화 할 내용 선언
 // main() 보다 먼저 수행
}
 - 그외 static import : 다른 클래스에 존재하는 static 멤버들을 불러와서 사용하기 위해 선언
   => 클래스명과 점을 통한 호출이 필요없이 바로 사용
  ex) import static packageName.ClassName.staticMemberName
  ex) import static packageName.ClassName.* // 모든 static 멤버 불러오기 가능

mysql 환경변수 설정 및 utf-8 변경 / DB 에러

#JAVA
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin

#MAVEN
export M2_HOME=/Users/jang-won-yong/dev/maven
export PATH=$PATH:$M2_HOME/bin

#DB  추가해서 home에서 편하게 mysql 접근 가능
export PATH=${PATH}:/usr/local/mysql/bin:JAVA_HOME/bin

#한글 설정
sudo vi /etc/my.cnf 에서 아래 내용 작성

[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
init_connect=SET collation_connection=utf8_general_ci
init_connect=SET NAMES utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

D3.js Library Study (Data-Driven Documents)

D3.js란 데이터와 이미지를 바인딩하는 라이브러리

  • 서버의 수치 데이터를 웹브라우져로 가져온 뒤 이를 브라우져 문서 요소로 변경하고 렌더링합니다. 그렇기 때문에 서버 데이터가 변경되면 웹브라우져는 변경된 요소를 반영하여 다시 그래프를 그리게 됩니다. 이렇게 D3.js를 이용하면 기존의 정적인 그래프를 데이터와 바인딩된 동적 그래프로 구현 할 수 있습니다.

D3.js 는 일반적으로 메서드 체이닝을 사용

  • 메서드가 객체를 반환하게 되면, 메서드의 반환 값인 객체를 통해 또 다른 함수를 호출할 수 있다. 이러한 프로그래밍 패턴을 메서드 체이닝 (Method Chaining) 이라 부릅니다.
// D3.js 가 데이터를 기반으로 돔을 생성
var data = [.....];
d3.select("body").selectAll("div) // 선언되어있는 body 문서요소에 가상의 문서요소 div 선언 여기에 그래프 그림
    .data(data) // 데이터를 바인딩
    .enter() // data 배열 요소 순회 하면서 가상의 문서요소 div 만듬
    .append("div); // 추가
.style("height", function (d) { // 첫번째 파라미터는 스타일의 속성 이름, 두번째 콜백함수 
     return d + "px";  // enter() 를 통해 생성된 각 문서요소를 반환하는 콜백함수 / d 를통해 실제 데이터 접근 가능 
}); // 픽셀단위

열린 포트 확인 / kill

$ lsof -i -nP | grep LISTEN | awk '{print $(NF-1)" "$1}' | sort -u
ex)
*:49152 rapportd
*:8095 java
*:8096 java
$ lsof -i -P // 전체 열린 포트 확인

$ lsof -i -P | grep -i "listen" // 열린 포트 확인
$ sudo lsof -i :80

$ sudo kill -9 [process id]      // sudo kill -9 823
 
$ sudo killall [process name]  //  sudo killall Python

Rest 개념 / Restful / Rest API / RestTemplete

RestFul ?

  • Rest Representational State Transfer 라는 용어의 약자로서 웹의 장점을 최대한 활용 할수 있는 아키텍처

  • URI 와 HTTP 메소드를 이용해 객체화된 서비스에 접근 하는 것!

Rest 의 특징

Uniform (유니폼 인터페이스)

  • Uniform Interface 는 uri 로 지정한 리소스에 대한 조작을 통일되고 한정적인 인터페이스로 수행하는 아키텍처 스타일

Stateless (무상태성)

  • 서버쪽에서 세션 쿠키등을 별도로 관리하지 않기 때문에 api서버는 요청만을 들어오는 메시지로만 처리하기 때문에 구현이 단순 !

Cacheable ( 캐시 처리 가능)

  • HTTP 표준 웹 그대로 사용
  • HTTP 가 가진 캐싱 기능 적용

Self-descriptiveness(자체 표현 구조)

  • Rest api 메시지만 보고도 이를 쉽게 이해 가능

Client - Server Architecture( 클라이언트 - 서버 구조 )

  • Rest 서버는 api를 제공하고, 제공된 api를 이용해서 비지니스 로직 처리 및 저장을 책임진다
  • 클라이언트의 경우 사용자 인증이나 컨택스트(세션, 로그인 정보) 등을 직접 관리하고 책임진다.
  • 서로간의 의존성이 줄어듬

계층형 구조

  • 클라이언트 입장에서는 Rest api 서버만을 호출
  • Rest 서버는 다중 계층으로 구성 가능 / 유연성 ( ex) 로드 밸런싱)

Rest 의 장점

  • Openapi 를 제공하기 쉽다
  • 멀티 플랫폼 지원 및 연동이 용이하다.
  • 원하는 타입으로 데이터를 주고 받을 수 있다 ( XML, JSON,)

Rest 의 단점

  • 사용할수 있는 메소드 4가지
  • HTTP 통신 모델 대해서만 지원

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.