Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Confluence URL: Installing the Server

데이터베이스 설치하기

SonarQube는 다양한 종류의 데이터베이스 엔진을 지원합니다. 사용하고자 하는 데이터베이스에 따라 다음 요구사항(필수)을 확인합니다.

데이터베이스 스키마 하나와 sonarqube 사용자 하나를 생성합니다. sonarqube 사용자는 스키마의 오브젝트 (create), 업데이트(update) 삭제(delete) 권한을 가져야 합니다. 데이터베이스의 문자셋은 "UTF-8", 언어(데이터베이스 사용자) "English" 설정해야 합니다.

Microsoft SQL Server

Collation 반드시 대소문자 구분(CS) 액센트 구분(AS) 설정되어야 합니다.

통합된 보안 정책을 사용하고자 하는 경우, http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774에서 Microsoft SQL JDBC Driver 4.2 패키지를 다운로드 한뒤, `sqljdbc_auth.dll` 원하는 경로에 복사합니다. 사용하는 서버 머신에 따라 x86 혹은 x64 버전의 dll 복사해야 합니다.

SoanrQube 윈도우 서비스로 운영하면서 통합된 보안 정책을 사용하고자 하는 경우, 서비스를 실행하는 윈도우 계정이 SQL Server 대한 접근 권한을 가지고 있는지 확인합니다. 해당 계정은 db_owner 데이터베이스 권한 가지고 있어야 합니다.

커맨드 라인 명령어로 SonarQube를 실행하면서 통합된 보안 정책을 사용하고자 하는 경우, 해당 계정 역시 db_owner 데이터베이스 권한을 가지고 있어야 합니다. 이와 함께 ```sonar.jdbc.username``` 혹은 sonar.jdbc.password의 주석처리가 되어 있는지 확인합니다. 주석처리가 되어 있지 않은 경우 SonarQube는 SQL authentication을 사용합니다.


sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true


SQL authentication 사용하고자 하는 경우, 아래의 컨넥션 스트링을 사용합니다. `sonar.jdbc.username`, `sonar.jdbc.password` 올바르게 설정되어 있는지 확인합니다.


sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar

sonar.jdbc.username=sonarqube

sonar.jdbc.password=mypassword



### MySQL


MySQL MyISAM, InnoDB 가지 엔진을 사용하도록 설정할 있습니다. MyISAM 엔진 보다 오래된 엔진이며, 점차 InnoDB 바뀌어 가는 추세입니다. InnoDB MyISAM SonarQube에서 분석하는 프로젝의 수가 증가할 때도 속도가 빠르며 스케일링이 됩니다. 여러분이 SonarQube 초기부터 사용했다면 여전히 MyISAM 엔진을 사용하는 테이블들을 가지고 있을 있습니다. SonarQube 성능을 개선하기 위해 모든 테이블들을 InnoDB 엔진으로 변경해야 합니다

SonarQube 사용하는 모든 테이블들이 InnoDB 엔진을 사용하도록 변경하고 나면, 다음으로 가장 ㅁ먼저  `innodb_buffer_pool_size` 파리미터를 변경헤 MySQL 최대한의 RAM 할당하고 `query_cache_size` 파라미터에 15MB 설정합니다. 보다 자세한 내용은 [InnoDB 성능 최적화](http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/) 참조합니다.


### Oracle


하나의  Oracle 인스턴스에 개의 SonarQube 스키마를 가진 경우--특히 스키마의 버전이 서로 다른 경우--SonarQube 가장 먼저 탐색된 스키마를 선택합니다. 문제점은 아래의 방법으로 해결합니다:


- SonarQube Oracle 사용자에게 할당된 priviledges 제거하거나

- Oracle 자동으로 새로운 컨텍션을 만들 경우 SonarQube Oracle 사용자를 변경하도록 합니다


ALTER SESSION SET current_schema="MY_SONARQUBE_SCHEMA"


(WARN) 드라이버 버전


Oracle 드라이버 12.1.0.1 12.1.0.2 버전은 주요한 오류를 포함하고 있어 SaonrQube 에코시스템과의 사용을 권장하지 않습니다([세부 내용 참고](https://groups.google.com/d/msg/sonarqube/Ahqt1iarqJg/u0BVRJZnBQAJ)).


### PostgreSQL


"public" 아닌 커스텀 스키마를 사용하고자 하는 경우, PostgreSQL `search_path` 속성은 다음과 같이 설정해야 합니다:


ALTER USER mySonarUser SET search_path to mySonarQubeSchema


## 서버 설치하기


먼저. [요구사항](https://docs.sonarqube.org/display/SONAR/Requirements) 확인합니다.


다음으로 [배포 패키지](http://www.sonarqube.org/downloads/) 다운로드 받아 압축을 풉니다(숫자로 시작하는 디렉토리명을 사용하지 마십시오). [네이티브 패키지](http://sonar-pkg.sourceforge.net/) 리눅스 용으로도 배보하고 있습니다.


_<install\_directory>_ SonarQube 배포 패키지의 압축이 풀린 디렉토리를 의미합니다.


### 데이터베이스 접근 권한 설정하기


_<install\_directory>_/conf.sonar.properties에서 데이터베이스를 설정합니다. 지원하는 모든 데이터베이스에 대한 설정 템플릿을 제공합니다. 사용하고자 하는 데이터베이스와 관련된 설정 템플릿의 주석을 해제하고 H2 데이터베이스와 관련된 설정 내용을 주석 처리합니다:


#### Example for PostgreSQL


sonar.jdbc.username=sonarqube

sonar.jdbc.password=mypassword

sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube


### JDBC 드라이버 추가하기


지원하는 데이터베이스(Oracle 제외) 관련된 드라이버는 SonarQube 패키지에 번들되어 있습니다. 번들된 드라이버만 정상 동작하므로, 해당 드라이버를 변경해서는 안됩니다.


Oracle 사용할 경우 _<install\_directory>_/extensions/jdbc-driver/oracle 드라이버를 복사합니다.


### 서버 시작하기


기본 포트는 "9000"이고, 기본 context 경로는 "/"입니다. 값은  _<install\_directory>_/conf/sonar.properties에서 변경할 있습니다:


#### sonar.properties


sonar.web.host=192.0.0.1

sonar.web.port=80

sonar.web.context=/sonar


다음 스크립트를 실행새 서버를 시작합니다:


- Linux/Mac OS: bin/\<YOUR OS>\/sonar.sh start

- On Windows: bin/windows-x86-XX/StartSonar.bat



브라우저에서 http://localhost:9000으로 SonarQube 접속할 있습니다 (기본 System administrator 계정은 admin, 비밀번호는 admin입니다).


### 서버 튜닝하기


기본적으로 SonarQube 단순한 하나의 Java JRE 설치된 컴퓨터에서 실행되도록 설정되어 있습니다.


성능 개선을 원하는 경우, SonarQube 인스턴스를 설치하면서 가장 먼저 해야할 일은 Java JDK 사용하는 것과 _<install¥_directory>_/conf/sonar.properties 수정해 서버 모드를 활성화하는 것입니다:


sonar.web.javaOpts=-server


SonarQube 사용하는 Java JVM 변경하고자 경우, _<install\_directory>_/conf/wrapper.conf 다음 라인을 변경합니다:


wrapper.java.command=/path/to/my/jdk/bin/java


### 설치 관련 고급 기능


- Windows 혹은 Linux에서 SonarQube Servie 작동하기

- Proxy 뒤에서 Sonarqube 운용하기


## 다음


서버 설치가 정상적으로 완료되었다면, 원하는 [플러그인을 설치](https://docs.sonarqube.org/display/SONAR/Installing+a+Plugin) 있습니다. 원하는 플러그인을 설치했다면 언제든지 [소스 코드를 분석](https://docs.sonarqube.org/display/SONAR/Analyzing+Source+Code) 시작할 있습니다.


## 트러블 슈팅 / 자주하는 질문


#### 서버 / 연산 엔진 / 엘라스틱 서치에 더욱 많은 메모리 할당 (Grant more memory to the web server / compute engine / elastic search)


서버 사이드 프로세스에 많은 메모리를 할당하고자 하는 경우, $SONARQUBE_HOME/conf/sonar.properties 파일에서 관련된 `javaOpts` 속성을 편집합니다:


- sonar.web.javaOpts (최소값: -server -Xmx768m)

- sonar.ce.javaOpts

- sonar.search.javaOpts


#### MySQL 데이터베이스에 접속 불가 (Cannot connect to MySQL database)


기본적으로 MySQL 데이터베이스 서버에 원격으로 접속하는 것은 보안상의 이유로 활성화 되어 있지 않습니다. 데이터베이스 서버에 원격으로 접속하고자 하는 경우, 링크된 [ 가이드(영문)](http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html) 참조합니다.


#### Windows Vista에서 구동 실패 (Failed to start on Windows Vista)


SonarQube Windows Vista _Program Files_ 디렉토리 아래 설치된 경우, 정상적으로 시작되지 않을 있습니다. 해당 디렉토리를 사용하지 않을 것을 권장합니다.



#### 잘못된 USERS 테이블 구조로 인해 SonarQube Oracle 데이터베이스 사용시 구동 실패 (Failed to start SonarQube with Oracle due to bad USERS table structure)


다른 USERS 테이블이 Oracle 데이터베이스에 존재하고, sonarqube 사용자가 다른 USERS 테이블에 읽기 권한을 가지고 있는 경우 SonarQube 웹서버는 다음과 같인 예외를 발생하며 구동하지 않습니다:


ActiveRecord::ActiveRecordError: ORA-00904: "TOTO": invalid identifier

: INSERT INTO users (login, name, email, crypted_password, salt, 

created_at, updated_at, remember_token, remember_token_expires_at, toto, id)

VALUES('admin', 'Administrator', '', 'bba4c8a0f808f9798cf8b1c153a4bb4f9178cf59', '2519754f77ea67e5d7211cd1414698f465aacebb',

TIMESTAMP'2011-06-24 22:09:14', TIMESTAMP'2011-06-24 22:09:14', null, null, null, ?)

ActiveRecord::ActiveRecordError: ORA-00904: "TOTO": invalid identifier

 

: INSERT INTO users (login, name, email, crypted_password, salt, 

created_at, updated_at, remember_token, remember_token_expires_at, toto, id)

VALUES('admin', 'Administrator', '', 'bba4c8a0f808f9798cf8b1c153a4bb4f9178cf59', 

'2519754f77ea67e5d7211cd1414698f465aacebb', TIMESTAMP'2011-06-24 22:09:14', TIMESTAMP'2011-06-24 22:09:14', null, null, null, ?)


문제를 수정하기 위해서는 sonarqube Oracle 사용자가 다른 USERS 테이블을 읽을 있는 권한을 제거해야 합니다.


#### 프록시를 통해 Update Cetner 접근 실패 (Failed to connect to the Update Center via proxy)


SONARQUBE_HOME/conf/sonar.properties 파일의 프록시 설정이 올바른지 확인합니다

프록시 username "\"(백슬래시) 문자가 포함된 경우, 특수문자 처리를 해주어야 합니다예를 들어 username "domain\user" 경우, 아래와 같이 설정합니다:


http.proxyUser=domain\\user


일부 프록시의 경우, 잘못된 username 혹은 password 설정의 원인으로 `"java.met.ProtocolException: Server redirected too many times"` exception 발생할 있습니다.

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.