* 문제 설명
수많은 마라톤 선수들이 마라톤에 참여하였습니다. 단 한 명의 선수를 제외하고는 모든 선수가 마라톤을 완주하였습니다.

마라톤에 참여한 선수들의 이름이 담긴 배열 participant와 완주한 선수들의 이름이 담긴 배열 completion이 주어질 때, 완주하지 못한 선수의 이름을 return 하도록 solution 함수를 작성해주세요.

* 제한사항
마라톤 경기에 참여한 선수의 수는 1명 이상 100,000명 이하입니다.
completion의 길이는 participant의 길이보다 1 작습니다.
참가자의 이름은 1개 이상 20개 이하의 알파벳 소문자로 이루어져 있습니다.
참가자 중에는 동명이인이 있을 수 있습니다.

 

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

 

public String solution(String[] participant, String[] completion) {
  // TODO Auto-generated method stub
  String rtn_val = "";

  ArrayList p1 = new ArrayList<>();
  ArrayList c1 = new ArrayList<>();

  for (int i =0 ; i<participant.length ; i++) {
    p1.add(participant[i]);
    if (i < participant.length-1) { //c1 이 1 개 작다
      c1.add(completion[i]);
    }
  }

//p1.retainAll(c1); // p1 에서 c1과 겹치는 부분만 남기고 나머지 삭제


// p1 에서 c1 에 포함된 객체를 삭제한다
// for(int i= p1.size()-1; i >= 0; i--) {
// if(c1.contains(p1.get(i)))
// p1.remove(i);
// }

//rtn_val = p1.toString();

/*
[1] : [leo]
[2] : [vinko]
[3] : []

3번 경우 [3] : mislav 가 나와야 함
이 방식은 중복도 함께 지워버림
*/

// Arrays.sort(participant);
// Arrays.sort(completion);
//
// for (int i=0 ; i<completion.length ; i++) {
//
// if ( !(completion[i].equals(participant[i] ) ) ) {
// rtn_val = participant[i];
// break;
// }
//
// if ("".equals( rtn_val )) {
// rtn_val = participant[participant.length-1];
// }
// }


  HashMap<String, Integer> hm = new HashMap<>();

  for (String player : participant) {
    //hm.put(player, hm.get(player) + 1);
    hm.put(player, hm.getOrDefault(player, 0) + 1);
  }
  for (String player : completion) {
    hm.put(player, hm.get(player) - 1);
  }

  System.out.println(hm);
  return rtn_val;
}

 

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

 

getOrDefault : key값이 없다면 입력시 설정한 default 값 반환

 

HashMap<String , String> map = new HashMap<String, String>();

String val = map.getOrDefault("key","val");

//HashMap 을 바로 생성하고 "key"라는 값을 바로 불러왔는데요.

// "key"로 저장된 값이 없기 때문에 디폴트로 "val"이라는 값이 val변수에 저장됩니다.

 

putIfAbsent : key 값이 없다면 입력된 key 와 value를 입력 , 해당 key 가 존재하면 입력되었던 값 반환

HashMap<String , String> map = new HashMap<String, String>();

map.putIfAbsent("key","val");

// 위의 코드는 null을 반환합니다.

// 다시 putIfAbsent()를 사용하면

map.putIfAbsent("key","val_new");

//이때는 이전에 입력한 "val"이 반환되고 다시 "key" 값의 밸류값은 "val_new"로 변경됩니다.

//이후에 "key"에대한 값은 "val_new"됩니다.

 

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

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

(인터넷 검색/펌 포함)

sort, hm

[1]

참여자명단과 완주자명단 비교 
-> hashtable ht 에 key 와 cnt 를 넣을 의도

동명이인 처리
-> 참가자를 (중첩)루핑 돌면서 동일인 : cnt=2 로

-> ht 가 > 0 이상이면 동일인 이 있다고 판단
완주자 명단 검사 -> cnt 가 안 맞으면 이게 정답

그 다음은 루핑 돌면서 검사
참여자 명단에 있는데 완주자 명단에 없으면 이게 정답

--------------------------------------------------
[2]

참여자명단과 완주자명단 -> sort 함

완주자 명단이 하나 적음
참여자 명단으로 for loop (참여자 명단의 마지막-1 까지만 루핑)
-> 다른 경우 정답

모두 동일한 경우 마지막이 정답

??
완주자로 for loop 돌아도 될 듯

--------------------------------------------------
[3]

1번이랑 비슷

참여자명단 loop 돌아 hm 에 key (이름) , value(1) 을 넣는다
완주자명단 돌면서 -1 해준다

마지막으로 hm loop 돌면서
value 가 1인거 찾는다


--------------------------------------------------
[4]

2번이랑 비슷

완주자로 for loop 돌아도 될 듯 -> 실제로 해봄

'프로그래밍언어' 카테고리의 다른 글

K번째수  (0) 2019.08.30
체육복  (0) 2019.08.30
모의고사  (0) 2019.08.30
HashMap 처리  (0) 2019.07.29
Arrays.asList() - 사용 시 주의  (0) 2019.07.29

https://megaidc.net/board_kRVd58/17022

 

 

 

1. Apache 최적화

– 아래 작성한 값은 알맞은 값이 아니며, 웹서버를 실행한 상태에서 지속적인 모니터링을 통해

알맞은 값을 찾아야 합니다.

1-1) Apache MPM (prefork, worker)

< prefork 방식 >

자식 프로세스를 미리 준비해두는 방식

자식 프로세스는 최대 1024

하나의 자식 프로세스당 1개의 스레드 연결

스레드간 메모리 공유를 하지 않아 독립적사용으로 안정적이나 메모리를 많이 사용함

< worker 방식 >

프로세스당 여러개의 스레드 연결

스레드간 메모리를 공유하여 메모리 사용량이 비교적 적음

통신량이 많은 서버에 적합

< event 방식>

아파치 2.4.x 버전부터 생성된 방식

– worker 방식을 기반으로 함

– keepalive 시에 클라이언트로부터 요청을 기다리고 있는 자식 프로세스 또는 자식 스레드 전체를 keep하게

되는 문제를 해결하기 위하여 리스닝 소켓과 기타 모든 소켓을 처리하는 각 프로세스를 위한 전용 리스너

스레드를 사용

< prefork 방식과 worker 방식의 차이>

– workerPrefork에 비해 적은 메모리를 사용한다.

– worker: 통신량이 많은 서버에 적절한 형태를 가진다.

– prefork: 안전하지 않은 제 3자가 만든 모듈을 사용할 수 있다.

– prefork: 디버깅이 빈약한 플랫폼에서 쉽게 디버깅 할 수 있다.

– prefork 방식과 worker 방식의 속도는 비슷하다.

대부분 prefork 방식이 기본적으로 사용되며, 사용자가 많은 경우에는 worker방식을 사용합니다.

<prefork 방식>

# /usr/local/apache/conf/extra/httpd-mpm.conf

 

StartServers 5

MinSpareServers 5

MaxSpareServers 10

MaxRequestWorkers 300

ServerLimit 300

MaxConnectionsPerChild 0

 

StartServer : 아파치서버의 자식 프로세스 개수 지정.

MinSpareServers, MaxSpareServers : 부하가 적어서 MinSpareServers 개수 보다 적었을 경우 최소한 이 개수 만큼 아파치가 유지하려 하며, 부하가 증가하여 프로세스 개수가 많아질 경우에 MaxSpareServers 개수 이하로 줄이려고 아파치가 구동 됩니다. 절대적인 수치는 아닙니다.

MaxRequestWorkers, ServerLimit : 기본값이 256 이기 때문에 MaxRequestWorkers 값이 256보다 작으면 따로 적을 필요가 없으며, 256보다 크면 그와 같은 값으로 설정해야합니다.

MaxReqeustPerChild : 클라이언트들의 요청 개수를 제한, 만약 자식 프로세스가 이 값만큼의 클라이언트 요청을 받았다면 이 자식 프로세스는 자동으로 kill 됩니다. (0 인 경우 무한대)

<worker 방식>

# /usr/local/apache/conf/extra/httpd-mpm.conf

 

StartServers 3

MaxClients 150

MinSpareThreads 75

MaxSpareThreads 250

ThreadsPerChild 25

MaxRequestWorkers 400

MaxConnectionsPerChild 0

 

StartServers(Default 3) : 시작시에 생성되는 서버 프로세스의 개수, 자식 프로세스의 수는 부하에 따라 동적으로 변경되기 때문에 이 값은 큰 의미가 없습니다.

ServerLimit (default : 16) : 구성 가능한 child 프로세스의 제한 수. ServerLimit 값이 필요 이상 높게 설정 된다면, 불필요한 공유 메모리가 할당 되므로 적절한 설정 필요합니다. MaxClient ThreadPerChild 에서 요구한 프로세스 수보다 높게 설정하지 마시기 바랍니다.

MaxClient (default : ServerLimit * ThreadsPerChild) : 동시에 처리될 최대 커넥션(request)의 수, MaxClients 수치를 초과한 후 온 요청들은 ListenBackLog에 의해 대기상태가 됩니다. ThreadsPerChild 옵션과 매우 긴밀하게 작용, 동시접속자가 많을 경우, MaxClient값을 증가시켜야 합니다. OSFD(File Descriptor)값을 증가 시켜 MaxClient 의 상한값을 증가시키시기 바랍니다.

MinSpareThreads(default 75) : 최소 thread 개수, 서버에 idle 쓰레드가 충분하지 않다면 child 프로세스는 idle 쓰레드가 MinSpareThreads 보다 커질때까지 생성됩니다.

MaxSpareThreads(default 250) : 최대 thread개수, 서버에 너무 많은 idle 쓰레드가 존재하면 child 프로세스는 idle 쓰레드가 MaxSpareThreads 수보다 작아질 때까지 kill 됩니다.

ThreadPerChild : 개별 자식 프로세스가 지속적으로 가질 수 있는 Thread의 개수.

MaxRequestPerChild : 자식 프로세스가 서비스할 수 있는 최대 요청 개수

– ThreadLimit (default : 64) : child 프로세스의 라이프주기 동안 ThreadsPerChild 의 최대 설정값을 설정합니다. ThreadLimit ThreadsPerChild 보다 훨씬 높게 설정된다면, 여분의 미사용 공유 메모리가 할당될 것입니다. ThreadLimit ThreadsPerChild 모두 시스템이 감당할 수 있는 값 보다 높게 설정하면, 아파치가 기동되지 않거나 시스템이 불안정하게 될 수 있습니다.최대 예상 ThreadsPerChild의 설정보다 높게 설정하면 안됩니다.

<event 방식>

# /usr/local/apache/conf/extra/httpd-mpm.conf

 

StartServers 3

MinSpareThreads 75

MaxSpareThreads 250

ThreadsPerChild 25

MaxRequestWorkers 400

MaxConnectionsPerChild 0

 

<현재 MPM 모듈 확인 방법>

# /usr/local/apache/bin/apachectl -V | grep -i mpm

Server MPM: event

1-2) httpd.conf 설정

이외에도 Timeout, KeepAlive, MaxKeepAliveRequests, MaxKeepAliveTimeout 같은 옵션도 성능에 영향을 미칩니다. /usr/local/apache/conf/httpd.conf 파일에서 설정을 할 수 있습니다.

-Timeout

지정한 시간동안 클라이언트가 응답이 없을 경우, 세션을 끊어 버립니다.

Timeout 60

-KeepAlive

지속적인 연결을 허용 여부를 설정합니다. 비활성화하려면 Off 를 입력하면 됩니다.

KeepAlive On

-MaxKeepAliveRequests

허용할 최대 요청 수를 지정합니다. 최상의 성능을 위해서는 수치를 높게 설정하는 것을 권장합니다.

무제한으로 설정하려면 0 으로 설정하면 됩니다.

MaxKeepAliveRequests 100

-KeepAliveTimeout

동일한 연결에서 동일한 클라이언트의 다음 요청을 대기하는 시간입니다.

응답이 없을 경우 서버가 클라이언트의 접속을 끊습니다.

KeepAliveTimeout 5

<Apache 동시접속자 확인하기>

아파치 서버가 현재 처리 중인 소켓 연결 개수를 확인할 수 있으며

설정한 MaxClients 수를 넘지 않도록 유의해야 합니다.

# netstat -nltp |grep :80.*ESTABLISHED | wc -l

하드웨어 자원을 고려한 가용 동시연결수 계산 = 여유 메모리 / 1연결당 메모리

2000MB free memory, 1연결당 20MB 를 사용 = 100개의 동시연결 가능. (300~500 동시접속자 처리가능)

1-3 ) 벤치마킹 테스트

<웹서버 벤치마킹 도구(ab) 사용하여 테스트>

# ab -n 3000 -c 300 http://localhost/

-n은 요청수를, -c 는 동시요청수를 나타낸다.

300명의 사용자가 10번씩 총 3000번 요청하는 것입니다.

사이트 주소의 끝에 / (슬래시)를 붙여야 합니다.

주요 옵션

Server Software : 아파치 버전을 표시

Server Hostname : 특정사이트의 이름

Server Port : 웹서비스 사용 포트 번호

Document Path : 초기 문서가 존재하는 웹문서 root위치

Time taken for tests : 응답시간(매우 중요한 결과 값)

Document Length : 초기문서의 크기

Complete requests : 요구에 응답완료한 세션 수

Failed requests : 요구에 응답실패한 세션 수

Broken pipe errors : 실패한 에러 수

Total transferred : 총 전송 바이트 수

HTTP transferred : 총 전송한 HTML 바이트 수

Requests per second : 초당 응답 요구 수

Time per request : 요구에 응답한 시간(단위 micro second, 중요한 결과값)

Time per request : 요구에 응답한 시간

Transfer rate : 초당 전송 가능한 용량

방식>

Benchmarking localhost (be patient)

Server Software: Apache/2.4.27

Server Hostname: localhost

Server Port: 80

Document Path: /

Document Length: 45 bytes

Concurrency Level: 300

Time taken for tests: 9.534 seconds

Complete requests: 3000

Failed requests: 0

Total transferred: 909000 bytes

HTML transferred: 135000 bytes

Requests per second: 314.68 [#/sec] (mean)

Time per request: 953.353 [ms] (mean)

Time per request: 3.178 [ms] (mean, across all concurrent requests)

Transfer rate: 93.11 [Kbytes/sec] received

Connection Times (ms)

min mean[+/-sd] median max

Connect: 0 1 1.8 0 9

Processing: 1 260 1218.8 17 9522

Waiting: 1 260 1218.8 17 9522

Total: 5 261 1219.7 17 9526

Percentage of the requests served within a certain time (ms)

50% 17

66% 18

75% 18

80% 18

90% 20

95% 225

98% 3328

99% 9523

100% 9526 (longest request)

방식>

Benchmarking localhost (be patient)

Server Software: Apache/2.4.27

Server Hostname: localhost

Server Port: 80

Document Path: /

Document Length: 45 bytes

Concurrency Level: 300

Time taken for tests: 0.592 seconds

Complete requests: 3000

Failed requests: 0

Total transferred: 867000 bytes

HTML transferred: 135000 bytes

Requests per second: 5069.15 [#/sec] (mean)

Time per request: 59.181 [ms] (mean)

Time per request: 0.197 [ms] (mean, across all concurrent requests)

Transfer rate: 1430.65 [Kbytes/sec] received

Connection Times (ms)

min mean[+/-sd] median max

Connect: 0 2 2.1 1 10

Processing: 2 27 71.8 13 578

Waiting: 0 26 71.7 12 578

Total: 7 29 72.5 14 585

Percentage of the requests served within a certain time (ms)

50% 14

66% 16

75% 17

80% 18

90% 24

95% 32

98% 222

99% 584

100% 585 (longest request)

1-4) 아파치 메모리 사용량 측정

전체 메모리 사용량을 아파치 프로세스 개수로 나누어 계산

# ps aux | grep apache | awk ‘{print $6}’ | awk ‘{total = total + $1 } END {print total/1024}’

 

# ps aux | grep apache | awk ‘{print $6}’ | awk ‘{total = total + $1 } END {print total/1024}’

25.4727

 

# ps aux | grep apache | awk ‘{print $6}’ | awk ‘{total = total + $1 } END {print total/1024}’

16.2109

 

# ps aux | grep apache | awk ‘{print $6}’ | awk ‘{total = total + $1 } END {print total/1024}’

15.3633

* 같은 환경에서 메모리 사용량은 worker, event 방식일 때 prefork 방식의 비해

낮은 값을 보였습니다.

 

Redis - Sentinel fail-over

 

 

1. 준비

- Redis 설치 : 3.0.503

- node.js 설치 : 6.10

 

2. Redis 설치 :

- download : https://github.com/ServiceStack/redis-windows/tree/master/downloads

(download 받아 압축 해제 )

 

 

3. node.js

- download 받아 압축 해제

 

4. redis.windows.conf 파일을 copy 하여 config 파일 작성

 

 

5. sentinel.conf 파일을 download / copy 하여 config 파일 작성

- http://download.redis.io/redis-stable/sentinel.conf

 

6. conf 폴더 하위에 작성

- Redis config (Master, Slave)

- Sentinel conf (총 3개)

 

 

7. conf 파일 수정(Master 예)

 

 

 

[redis.master6379.conf]

port 6379 

bind 127.0.0.1 

 

[redis.slave6380.conf]

port 6380 

bind 127.0.0.1 

# slaveof <masterip> <masterport>

slaveof 127.0.0.1 6379

 

 

8. Master 기동 (port : 6379)

- 기동 : redis-server.exe .\conf\redis.master6379.conf

 

 

9. Redis client 로 key 저장

- mykey : Hello Redis

 

 

10. Sentinel config 설정

 

 

 

# 포트 변경(각각 26279, 26380, 26381 로 설정)

port 26379

 

#-->

sentinel monitor mymaster 127.0.0.1 6379 2

# Default is 30 seconds.

sentinel down-after-milliseconds mymaster 30000

sentinel parallel-syncs mymaster 1

# Default is 3 minutes.

sentinel failover-timeout mymaster 180000

#<-- 이부분(주요 설정)은

 

#dir /tmp

dir .\tmp

#폴더 생성 후 지정

 

 

11. Slave 기동 (port : 6380)

- 기동 :  redis-server.exe .\conf\redis.slave6380.conf

 

 

12. Master 의 Sync 메시지 확인 (port : 6379)

 

 

13. Sentinel 기동

 

redis-server.exe .\conf\sentinel.26379.conf --sentinel 

redis-server.exe .\conf\sentinel.26380.conf --sentinel 

redis-server.exe .\conf\sentinel.26381.conf --sentinel

 

 

 

 

14. node.js 테스트

 

 

npm 으로 ioredis install -> 소스작성 -> 실행

- (명령) npm install ioredis

 

 

var Redis = require('ioredis');

var redis = new Redis ( {

    sentinels: [     { host:  '127.0.0.1',  port: 26397 }

                    , { host:  '127.0.0.1',  port: 26380 }

                    , { host:  '127.0.0.1',  port: 26381 }

                ],

    name: 'mymaster'

    });

   

    redis.get('mykey' , function (err, result) {

        console.log(result);

    });

   

    redis.quit();

 

15. Master(port : 6379) shutdown

 

 

16. Sentinel (port : 26379) shutdown

 

 

17. Slave (port : 6380) 이 Master 로 승격

 

 

18. Sentinel (port : 26380, 26381) Master 를 투표/선출

 

 

 

 

 

Nginx - Jboss 연동, fail-over

 

 

1. 준비

- Nginx 설치 : 1.8.0

- Jboss 설치 : 5.1.0

 

2. Nginx : 1년전에 설치만 해두었던 것 활용

             (다운로드 후 압축해제..)

 

3. Jboss 설치

- download : http://jbossas.jboss.org/downloads.html

 

 

- 5.1.x 를 테스트 할 필요 있어서 5.1.0 다운로드

 

 

 

4. jboss 설치(압축 해제) 후

- JBOSS_HOME\server\all 을 copy 하여

- node1, node2 만든다.

 

 

 

5. JBOSS_HOME\bin 의 run.bat 수정

- JBOSS_HOME 지정 : 압축 푼 위치

- JAVA_HOME : 로컬의 설치 위치

 

 

6. node1, node2 기동 스크립트 작성

 

 

[run_node1.bat]

cd D:\dev\jboss\jboss-5.1.0.GA\bin

run.bat  -c node1 -g testCluster -u 239.255.100.100 -b 127.0.0.1 -Djboss.messaging.ServerPeerID=1 -Djboss.service.binding.set=ports-default

 

[run_node2.bat]

cd D:\dev\jboss\jboss-5.1.0.GA\bin

run.bat  -c node2 -g testCluster -u 239.255.100.100 -b 127.0.0.1 -Djboss.messaging.ServerPeerID=2 -Djboss.service.binding.set=ports-01

 

옵션은 다음과 같음(인터넷 참조)

     -c : 생성한 node 명 (node1, node2)

     -g : 클러스터 명 (testCluster)
     -u : 내부 클러스터 통신을 위한 멀티캐스트 주소
     -b : 소켓에 바운딩될 아이피 주소

 

7. 소스 생성

- ROOT.war copy 해서 test.war 생성

 

 

- 내부에는 WEB-INF 폴더와 web.xml 만 남겨둠

- web.xml 도 필요 없는 내용 다 지움

 

 

[web.xml]

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app> 

    <display-name>Welcome to JBoss</display-name> 

    <description>     Welcome to JBoss  </description>

 

</web-app> 

     

- 테스트 페이지 작성

 

8. Nginx 설정

 

- location 부분 과 upstream 설정

- max_fails 를 설정하지 않으면

- fail-over 가 되긴 하나 지연시간이 길다(10~20여초)

 

 

 server {

        listen       80;

        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

 ... (생략)

               

        location /test {

            proxy_pass   http://backend;

        }

     }

 ... (생략)

 

 upstream backend {

        server 127.0.0.1:8080  max_fails=2;

        server 127.0.0.1:8180;

    }

 

 

9. Jboss 기동

 

- 1번 기동

 

- 2번 기동

 

- 2번에 Clustering 메시지 표지 (New Member... 등등)

 

10. Jboss 확인(기동)

- 1번 기동 (8080 port)

 

- 2번 기동 (8180 port)

 

11. Nginx 확인(80 포트로 접속)

 

 

12. Fail-over 테스트

- 1번 Shutdown

 

- 2번에 Clustering 메시지 표지 (Member Dead... 등등)

 

13. Nginx 재확인(80 포트로 접속)

 

 

 

PCC-F-NOERRFILE, unable to open error message file, facility PR2

 

 D:\dev\instantclient_11_2\sdk>proc
PCC-F-NOERRFILE, unable to open error message file, facility PR2

 

D:\dev\instantclient_11_2\sdk>set Path=D:\dev\instantclient_11_2;%Path%

 

D:\dev\instantclient_11_2\sdk>proc

Pro*C/C++: Release 11.2.0.1.0 - Production on Sat Dec 24 20:58:20 2016

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

System default option values taken from: d:\dev\instantclient_11_2\precomp\admin
\pcscfg.cfg

Option Name    Current Value  Description
-------------------------------------------------------------------------------
auto_connect   no             Allow automatic connection to ops$ account
char_map       charz          Mapping of character arrays and strings
close_on_commitno             Close all cursors on COMMIT
cmax           100            CMAX Value for connection pool
cmin           2              CMIN Value for connection pool

 

...

 

 

Error during SonarQube Scanner execution - SCM

 


ERROR: Error during SonarQube Scanner execution

java.lang.IllegalStateException: Error when executing blame for file src/main/java/OOO/OOO/OOO/OOOController.java
        at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:102)
        at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:59)
        at org.sonar.scanner.scm.ScmSensor.execute(ScmSensor.java:86)

...

Caused by: org.tmatesoft.svn.core.SVNException: svn: E175002: connection refused by the server

svn: E175002: OPTIONS request failed on '/svn/OOO/OOO/src/main/java/OOO/OOO/OOO/OOO/OOOController.java'

        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:106)

        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:90)


...


Caused by: java.net.ConnectException: Connection timed out: connect

        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)

        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)


 


Administration > Configuration > General Settings


SCM > Disable the SCM Sensor




windows 에서 Apache 여러개 기동

 

conf 파일을 복사 후 기동

 

D:\dev\Apache24test\servers\OOO>start /d "D:\dev\Apache24test\bin\" /b httpd.exe -f "D:\dev\Apache24t
est\servers\OOO\conf\httpd.conf" -n Apache2.4 -k start

 

D:\dev\Apache24test\servers\OOO>[Tue Oct 04 14:53:10.620622 2016] [mpm_winnt:error] [pid 8200:tid 180
] (OS 2)지정된 파일을 찾을 수 없습니다.  : AH00436: No installed service named "Apache2.4".

 

오류 발생하여 (install 함)

 

D:\dev\Apache24test\bin>httpd -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started. 

 

(bat 파일로 start, stop)

start /d "D:\dev\Apache24test\bin\" /b httpd.exe -f "D:\dev\Apache24test\servers\OOO\conf\httpd.conf" -k start

 

start /d "D:\dev\Apache24test\bin\" /b httpd.exe -f "D:\dev\Apache24test\servers\OOO\conf\httpd.conf" -k stop

 

 

 

Apache 여러개 기동

 

(설치 폴더, 예)

/usr/local/server/apache

 

(하위 conf 파일을 특정위치에 복사, 예)

/usr/local/server/apache/servers/102AA/conf

 

(start shell 만들어 줌)
/usr/local/server/apache/bin/apachectl -f /usr/local/server/apache/servers/102AA/conf/httpd.conf -k start

 

(stop shell 만들어 줌)
/usr/local/server/apache/bin/apachectl -f /usr/local/server/apache/servers/102AA/conf/httpd.conf -k stop


(설정 변경, 필요 시)

Listen 80
ServerName 192.168.56.102:80

->

Listen 8080
ServerName 192.168.56.102:8080

 

(디렉토리 위치 변경, 필요 시)

DocumentRoot "/source/test/102AA"
<Directory "/source/test/102AA">

...

 

(로그 위치 변경, 필요 시)
ErrorLog "/logs/apache/102AA/error_log"
CustomLog "/logs/apache/102AA/access_log" common

 

 

CentOS - Apache 2.4 설치

(httpd-2.4.12)

 

 [root@localhost httpd-2.4.12]# ./configure --prefix=/usr/local/etc/httpd-2.4.12/server --with-mpm=worker --enable-so --enable-ssl
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.

 

(필요 패키지 설치 후 실행)
apr-1.5.2     
apr-util-1.5.4 
pcre-8.36   

 

 

pache compile

 

 ./configure \
--prefix=/usr/local/server/apache \
--enable-module=so \
--enable-so \
--with-mpm=worker \
--enable-mods-shared=all \
--with-apr=/usr/local/apr \
--with-pcre=/usr/local/pcre

 

수행 로그

 

 [root@localhost httpd-2.4.12]# ./configure \
> --prefix=/usr/local/server/apache \
> --enable-module=so \
> --enable-so \
> --with-mpm=worker \
> --enable-mods-shared=all \
> --with-apr=/usr/local/apr \
> --with-pcre=/usr/local/pcre
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to " -g -O2 -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes

(생략)

 

 

apache make

 

 [root@localhost httpd-2.4.12]# make && make install
Making all in srclib
make[1]: Entering directory `/usr/local/etc/httpd-2.4.12/srclib'
make[1]: Leaving directory `/usr/local/etc/httpd-2.4.12/srclib'
Making all in os
make[1]: Entering directory `/usr/local/etc/httpd-2.4.12/os'
Making all in unix
make[2]: Entering directory `/usr/local/etc/httpd-2.4.12/os/unix'
make[3]: Entering directory `/usr/local/etc/httpd-2.4.12/os/unix'
/usr/local/apr/build-1/libtool --silent --mode=compile gcc -std=gnu99  -g -O2 -pthread      -DLINUX -D_REENTRANT -D_GNU_SOURCE     -I. -I/usr/local/etc/httpd-2.4.12/os/unix -I/usr/local/etc/httpd-2.4.12/include -I/usr/local/apr/include/apr-1 -I/usr/local/pcre/include -I/usr/local/etc/httpd-2.4.12/modules/aaa -I/usr/local/etc/httpd-2.4.12/modules/cache -I/usr/local/etc/httpd-2.4.12/modules/core -I/usr/local/etc/httpd-2.4.12/modules/database -I/usr/local/etc/httpd-2.4.12/modules/filters -I/usr/local/etc/httpd-2.4.12/modules/ldap -I/usr/local/etc/httpd-2.4.12/server -I/usr/local/etc/httpd-2.4.12/modules/loggers -I/usr/local/etc/httpd-2.4.12/modules/lua -I/usr/local/etc/httpd-2.4.12/modules/proxy -I/usr/local/etc/httpd-2.4.12/modules/session -I/usr/local/etc/httpd-2.4.12/modules/ssl -I/usr/local/etc/httpd-2.4.12/modules/test -I/usr/local/etc/httpd-2.4.12/server -I/usr/local/etc/httpd-2.4.12/modules/arch/unix -I/usr/local/etc/httpd-2.4.12/modules/dav/main -I/usr/local/etc/httpd-2.4.12/modules/generators -I/usr/local/etc/httpd-2.4.12/modules/mappers  -prefer-non-pic -static -c unixd.c && touch unixd.lo

 

(생략)

 

 

undefined reference to `WSAStartup@8'

CodeBlocks - C 프로그래밍(윈도우 기반 TCP/IP 소켓)

 

undefined reference to `WSAStartup@8' 오류 발생

 

 

[build options ] 클릭

 

 

[Linker settings] 탭 [Add] 클릭

 

 

파일 찾기 [...] 클릭

 

 

ws2_32.dll 선택 후 [OK]

 

 

[OK]

 

 

실행

 

+ Recent posts