Skip to content

Instantly share code, notes, and snippets.

@jrafanie
Last active June 15, 2017 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrafanie/5ef89f69850b0f922c488775d6219d61 to your computer and use it in GitHub Desktop.
Save jrafanie/5ef89f69850b0f922c488775d6219d61 to your computer and use it in GitHub Desktop.
Change ManageIQ server settings from a single location
# 1) you'll need https://github.com/ManageIQ/manageiq/blob/master/tools/configure_server_settings.rb
# 2) copy this file to /var/www/miq/vmdb/tools
# 3) Then cd to vmdb via the 'vmdb' command alias
# 4) Create a list of miq_servers table ids for all of the target servers. I use 1000000000001 here.
# Or just do them all:
# ids = MiqServer.pluck(:id)
# 5) run this script in bin/rails console (if copy/paste works) or put this script into a file, update_settings.rb, in vmdb and run it using bin/rails r 'update_settings.rb'
# 6) Repeat this process for each region/database.
ids = %w(
1000000000001
)
ids.each do |id|
`./tools/configure_server_settings.rb -s "#{id}" -p workers/worker_base/queue_worker_base/generic_worker/stopping_timeout -v 60.minutes`
`./tools/configure_server_settings.rb -s "#{id}" -p workers/worker_base/queue_worker_base/priority_worker/stopping_timeout -v 60.minutes`
`./tools/configure_server_settings.rb -s "#{id}" -p workers/worker_base/queue_worker_base/generic_worker/memory_threshold -v 1.gigabyte`
`./tools/configure_server_settings.rb -s "#{id}" -p workers/worker_base/queue_worker_base/priority_worker/memory_threshold -v 1.gigabyte`
end
03:11:58 ~/Code/manageiq (master) (2.4.1) - bin/rails c
** Using session_store: ActionDispatch::Session::MemCacheStore
Loading development environment (Rails 5.0.3)
irb(main):001:0> MiqGenericWorker.worker_settings[:memory_threshold]
=> 1073741824
irb(main):002:0> MiqGenericWorker.worker_settings[:stopping_timeout]
=> 3600
irb(main):003:0> MiqPriorityWorker.worker_settings[:memory_threshold]
=> 1073741824
irb(main):004:0> MiqPriorityWorker.worker_settings[:stopping_timeout]
=> 3600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment