为了更轻松地配置 TimescaleDB,您可以使用 timescaledb-tune
工具。此工具根据您的系统处理将最常用的参数设置为合适的值。它会考虑内存、CPU 和 PostgreSQL 版本。 timescaledb-tune
作为依赖项与 TimescaleDB 二进制版本一起打包,因此如果您从二进制版本(包括 Docker)安装了 Timescale,您应该已经可以访问该工具。或者,您可以使用 go install
命令来安装它
go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@latest
timescaledb-tune
工具读取您系统的 postgresql.conf
文件,并为您的设置提供交互式建议。这是一个工具运行的示例
Using postgresql.conf at this path:/usr/local/var/postgres/postgresql.confIs this correct? [(y)es/(n)o]: yWriting backup to:/var/folders/cr/example/T/timescaledb_tune.backup202101071520shared_preload_libraries needs to be updatedCurrent:#shared_preload_libraries = 'timescaledb'Recommended:shared_preload_libraries = 'timescaledb'Is this okay? [(y)es/(n)o]: ysuccess: shared_preload_libraries will be updatedTune memory/parallelism/WAL and other settings? [(y)es/(n)o]: yRecommendations based on 8.00 GB of available memory and 4 CPUs for PostgreSQL 12Memory settings recommendationsCurrent:shared_buffers = 128MB#effective_cache_size = 4GB#maintenance_work_mem = 64MB#work_mem = 4MBRecommended:shared_buffers = 2GBeffective_cache_size = 6GBmaintenance_work_mem = 1GBwork_mem = 26214kBIs this okay? [(y)es/(s)kip/(q)uit]:
当您回答完问题后,更改将写入您的 postgresql.conf
文件,并在您下次重启时生效。
如果您从新的实例开始,并且不想批准每组更改,则可以在运行该工具时使用一些额外的标志来自动接受建议并将其附加到 postgresql.conf
文件的末尾
timescaledb-tune --quiet --yes --dry-run >> /path/to/postgresql.conf
关键词
在此页面上发现问题?报告问题 或 在 GitHub 上编辑此页。