首页 > 数据库 > PostgreSQL > 正文

一个老外对postgresql.conf的重新组织

2020-03-12 23:54:23
字体:
来源:转载
供稿:网友
配置文件很长,不好管理,一般就是一些主要参数,我们重新组织一下 

Java代码  一个老外对postgresql.conf的重新组织
  1. ## Connecting    
  2. port                            = 5432    
  3. listen_addresses                = '*'    
  4. max_connections                 = 100    
  5. ssl                             = on  
  6.     
  7. ## Memory    
  8. shared_buffers                  = 100MB    
  9.     
  10. ## Disk    
  11. fsync                           = on    
  12. synchronous_commit              = on    
  13. full_page_writes                = on    
  14. checkpoint_segments             = 3    
  15.     
  16. ## PITR    
  17. archive_mode                    = on    
  18. archive_command                 = 'cp %p /usr/local/pgsql/arch/%f;scp %p 218.193.224.22:/usr/local/pgsql/arch_from_11/%f'    
  19. archive_timeout                 = 0    
  20. wal_level                       = hot_standby  
  21. max_wal_senders                 = 1   
  22.     
  23. ## Planner    
  24. effective_cache_size            = 128MB    
  25. random_page_cost                = 4.0    
  26.     
  27. ## Logging    
  28. log_destination                 = 'stderr'    
  29. logging_collector               = on    
  30. log_filename                    = 'pg%Y-%m-%d_%H%M%S.log'    
  31. silent_mode                     = on  
  32. client_min_messages             = log  
  33. log_min_messages                = log  
  34. log_truncate_on_rotation        = off    
  35. log_rotation_age                = 1d    
  36. log_rotation_size               = 10MB    
  37. log_min_duration_statement      = -1    
  38. log_statement                   = 'none'    
  39. log_line_prefix                 = '%t %u@%d %p'    
  40.     
  41. ## Autovacuum    
  42. autovacuum                      = on    
  43. autovacuum_vacuum_scale_factor  = 0.2    
  44. autovacuum_analyze_scale_factor = 0.1    


还可以把一些替换参数集合起来,放在一个位置,如文件尾部,用于快速替换这些参数 
老外举了一个了例子,在大流量访问的时候以下三个参数关闭,避免影响性能. 
Java代码  一个老外对postgresql.conf的重新组织
  1. ## Bulk loading only - leave 'on' for everyday use!  
  2. autovacuum                      = off  
  3. fsync                           = off  
  4. full_page_writes                = off  


遵循后置有效哦,同一参数设置以最后一次出现为准. 
而且8.3以后新配置文件中删除了前一次的配置项后reload自动变默认, 
以前版本删除了配置文件中某项设置,reload后保持前一设置不变
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表