Does setting Max Time Out in Marklogic 4.2.9 need the server to be restarted?

痴心易碎 提交于 2019-12-25 05:22:45

问题


I am updating the XDBC server configurations on my clustered ML 4.2.9 server using

admin:appserver-set-max-time-limit($config,$id,$maxTimeLimit )
admin:save-configuration-without-restart()

However, after setting this configuration, MarkLogic specifies 2 ways of persisting this change.

  1. admin:save-configuration-without-restart()
  2. admin:save-configuration()

For 1, The ML documentation states "If you use this function to save any changes that require a server restart ("cold" changes such as App Server port assignment changes), then the changes will not take effect until the next time MarkLogic Server restarts (although they will be saved in the configuration)"

Can some one please tell me, whether admin:appserver-set-max-time-limit is a cold change or hot. Meaning, will my changes be effective ASAP if I use admin:save-configuration-without-restart() (which I am planning to use). Otherwise I will have to roll these changes as planned activities so that the server downtime can be factored in.

Thanks


回答1:


I just ran the xquery

admin:appserver-set-max-time-limit($config,$id,$maxTimeLimit )
admin:save-configuration-without-restart()

and set the $maxTimeLimit=60 secs and I can still see other XQueries running beyond 1 min. So, I guess this change needs a cold restart of the server.

But, please do let me know if anyone know otherwise.




回答2:


It is a hot change. You can see this in the admin UI: 'max time limit' does not have an asterisk (*) next to it.

But your code looks funny, and I think that is why it isn't working. Take another look at the example at http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/apidoc/admin.xml&category=Admin+Library&function=admin:save-configuration-without-restart

let $config := admin:get-configuration()
let $spec := admin:forest-set-enabled($config, 
  xdmp:forest("myForest"), fn:true() )
return
  admin:save-configuration-without-restart($spec)

Your code is missing the argument to admin:save-configuration-without-restart(), so it will do nothing. Furthermore it's crucial to save the new version of the config. XQuery variables are normally immutable, so the sample does this using a new variable. You can also recycle the same variable name, although it's important to understand that this is reuse not mutation.

let $config := admin:get-configuration()
let $config := admin:forest-set-enabled($config,
  xdmp:forest("myForest"), fn:true() )
return
  admin:save-configuration-without-restart($config)

Or this is closer to what I usually do, using xdmp:set for mutation. I wouldn't use xdmp:set in most application code, but for deployment the benefits outweigh the disadvantage of introducing mutability.

declare variable $CFG := admin:get-configuration() ;

xdmp:set(
  $CFG, admin:forest-set-enabled($CFG, xdmp:forest("myForest"), fn:true())
,
admin:save-configuration-without-restart($CFG)

One way to test this is to go look at the admin UI. If it doesn't reflect your changes, with or without a restart, then something is wrong with your code.




回答3:


@mblakele Here's the actual code that I used

xquery version "1.0-ml"; 

import module namespace admin = "http://marklogic.com/xdmp/admin" 
          at "/MarkLogic/admin.xqy";

declare variable $maxTimeLimit := 60;
declare variable $defaultTimeLimit := 60;

if ($defaultTimeLimit<=$maxTimeLimit) 
then ( 
    let $config := admin:get-configuration()
    let $groupid := admin:group-get-id($config, "Default")
    let $ids:= admin:group-get-xdbcserver-ids($config, $groupid)
    return (
            for $id in $ids 
                        return 
            let $new_config := admin:appserver-set-max-time-limit($config,$id,$maxTimeLimit )
                let $final_config := admin:appserver-set-default-time-limit($new_config,$id,$defaultTimeLimit )
                return admin:save-configuration-without-restart($final_config)

))
else ()

This does the trick for me and I can see in the Admin UI, that the time out value has been updated. But, when I run another XQuery which usually takes more than 60 secs, it is not timed out. Any reason why? Also, the example at http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/apidoc/admin.xml&category=Admin+Library&function=admin:save-configuration-without-restart does not talk about ussing the admin:forest-set-enabled($config,xdmp:forest("myForest"), fn:true() )

Is calling admin:forest-set-enabled really required? As I can see the config changes are stored (although they are not effective)



来源:https://stackoverflow.com/questions/12250603/does-setting-max-time-out-in-marklogic-4-2-9-need-the-server-to-be-restarted

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!