odyssey 试用

以下是odyssey 的一个试用

环境准备

  • docker-compose 文件
version: "3"
services:
  postgres:
    image: postgres:12
    ports:
      - "5432:5432"
    environment:
      - "POSTGRES_PASSWORD=dalong"
  pgbouncer:
    image: brainsam/pgbouncer
    ports:
      - "6543:6543"
    volumes:
      - "./pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini"
      - "./users.txt:/opt/auth/users.txt"
  app:
    image: kksudo/odyssey-docker:1.1
    ports:
      - "6432:6432"
    volumes:
      - "./odyssey-dev.conf:/etc/odyssey/odyssey.conf"
  • 说明
    环境包含了pgbouncer以及odyssey,配置说明
    pgbouncer.ini
 
[databases]
postgres = host=postgres port=5432  auth_user=postgres
[pgbouncer]
listen_addr = 0.0.0.0
auth_type = md5
auth_file = /opt/auth/users.txt
listen_port = 6543
ignore_startup_parameters = extra_float_digits
verbose = 2
admin_users = postgres

odyssey.conf

daemonize no
unix_socket_dir "/tmp"
unix_socket_mode "0644"
log_format "%p %t %l [%i %s] (%c) %m\n"
log_to_stdout yes
log_syslog no
log_syslog_ident "odyssey"
log_syslog_facility "daemon"
log_debug yes
log_config yes
log_session yes
log_query no
listen {
    host "*"
    port 6432
    backlog 128
}
storage "postgres_server" {
    type "remote"
    host "postgres"
    port 5432
}
database default {
    user default {
        authentication "md5"
        storage "postgres_server"
        pool "transaction"
        pool_size 0
        pool_timeout 0
        pool_ttl 60
        password "md5f293e70a2114bd91a4a1203a5f0548cd"
        pool_discard no
        pool_cancel yes
        pool_rollback yes
        client_fwd_error yes
        application_name_add_host yes
        server_lifetime 3600
        log_debug no
        quantiles "0.99,0.95,0.5"
    }
}
storage "local" {
    type "local"
}
database "console" {
    user default {
        authentication "none"
        pool "session"
        storage "local"
    }
}

访问

我们可以通过 127.0.0.1 6543 postgres dalong 以及6432 端口,odyssey 是一个很不错的选择,同时配置上还是比较清晰的

参考资料

https://github.com/yandex/odyssey/blob/master/documentation/configuration.md#example-1
https://www.pgbouncer.org/
https://github.com/rongfengliang/postgres-connect-pool-tools-learning

posted on 2020-08-22 17:21  荣锋亮  阅读(331)  评论(0编辑  收藏  举报

导航