Skip to content

Update Resource

Update Resources via Dashboard

Click on Resource menu to select the resource which you want to update, then click Edit button

image-20210301140017790

It will pop a edit dialog:

image-20210301140307433

Input your new params and click Confirm button

image-20210301140356148

At this time, you will be prompted whether to confirm the modification, just click the Confirm button. The following figure shows the modified effect: image-20210301140450539

At this time the "description" information has been updated.

Update Resources by Command Line Tool

To update through the command line, you need to know the ID of the resource in advance:

image-20210301140900098

Then use the following command to update:

shell
emqx_ctl resources update $ID -d $Desc -c $Config

The first parameter after update is the resource ID, the -d parameter is "description" and the -c parameter is the JSON string format of the specific resource parameter:

For example:

json
{
    "verify":false,
    "url":"http://www.demo.com",
    "request_timeout":5,
    "pool_size":32,
    "keyfile":"",
    "connect_timeout":5,
    "certfile":"",
    "cacertfile":""
}

It's string format is:

shell
"{\"verify\":false,\"url\":\"http://www.demo.com\",\"request_timeout\":5,\"pool_size\":32,\"keyfile\":\"\",\"connect_timeout\":5,\"certfile\":\"\",\"cacertfile\":\"\"}"

Full command:

shell
emqx_ctl resources update resource:001 -d "hello" -c "{\"verify\":false,\"url\":\"http://www.demo.com\",\"request_timeout\":5,\"pool_size\":32,\"keyfile\":\"\",\"connect_timeout\":5,\"certfile\":\"\",\"cacertfile\":\"\"}"

So far, we have completed two ways to update resources through the management interface and the command line.