manywaypark's Blog
개발, 검색, 함수

'PostgreSQL'에 해당되는 글 3건

  1. 2018.11.01 docker에 redmine 설치하기
  2. 2015.08.21 pgloader - from mysql to postgresql
  3. 2015.08.21 PostgreSql index 생성

docker에 redmine 설치하기

tips & tricks 2018. 11. 1. 16:35 by manywaypark

기본적으로 container 두 개를 postgresql, redmine으로 실행하면 된다.

두 container를 연결하는 것말고는 뭐 특별한 것은 없다.

아래 참조 링크에서는 backend DB로 MySQL을 사용하는데 나는 Postgresql을 선호하므로 Postgresql을 썼다.


최초 설정:

docker run --name my.postgres -e POSTGRES_PASSWORD=DB_PASSWORD_HERE -d -p 5432:5432 postgres

docker run -d --name my.redmine -p 3000:3000 --link my.postgres:postgres redmine


이제 http://localhost:3000 에 접속하면 redmine을 사용할 수 있다. 최초의 user/password는 admin/admin이다.


이후 실행:

docker start my.postgres my.redmine


NOTE: 여기서 사용한 postgres image는 container를 commit해서 image를 만들어도 data가 보존되지 않는다. (참고 링크 2번 참고)


ref:

http://pseg.or.kr/pseg/infoinstall/6103

https://stackoverflow.com/questions/27377876/docker-postgres-with-initial-data-is-not-persisted-over-commits


happy hackin'

pgloader - from mysql to postgresql

tips & tricks 2015. 8. 21. 17:08 by manywaypark

mysql에서 postgresql로 이전하는 방법에 대해 간략히 기술한다.


# 소스 받고 빌드하기

⟫ apt-get install sbcl unzip libsqlite3-dev make curl gawk freetds-dev libzip-dev

⟫ git clone https://github.com/dimitri/pgloader.git

⟫ cd pgloader

⟫ make pgloader


# pgloader 사용 해서 옮기기

⟫ sudo -u postgres build/bin/pgloader mysql://user:password@localhost/from_db postgresql://user:password@localhost/to_db


# schema만 덤프

⟫ sudo -u postgres pg_dump -s to_db > /tmp/schema_for_postgresql.sql


# TODO

덤프한 schema 파일을 열어보면 실제로는 동일한 것들이 중복되어 있는 경우가 있다 (ENUM 등). 수작업이 좀 필요한 부분이다.

schema를 깔끔히 정리하고, 관련 code를 변경한다.


추가적으로 erlang 사용자는 sqerl을 사용하면 인생이 조금 편해질 것이다.


refs:

  • http://pgloader.io/
  • http://pgloader.tapoueh.org/howto/pgloader.1.html
  • https://github.com/chef/sqerl


happy hackin'

PostgreSql index 생성

tips & tricks 2015. 8. 21. 14:42 by manywaypark

PostgreSql에서는 table creation시에 index를 생성할 수 없다.

다만 primary key나 unique는 자동으로 index가 생성된다.


ref: http://stackoverflow.com/questions/6239657/postgresql-can-you-create-an-index-in-the-create-table-definition


happy hackin'

1 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

04-17 05:30