Video Screencast Help

How to manually edit the main.cf file

Created: 05 Apr 2013 • Updated: 05 Apr 2013 | 6 comments
This issue has been solved. See solution.

Hi,

 

I need to make a very minor edit to the main.cf file. I am assuming this is the way to do this:

 

haconf -makerw

edit main.cf on one of the nodes  i.e vi /etc/VRTSvcs/conf/config/main.cf

save changes

hacf -verify /etc/VRTSvcs/conf/config

haconf -dump -makero

Operating Systems:

Comments 6 CommentsJump to latest comment

g_lee's picture

Using your procedure to edit main.cf would lose your changes (ie: it won't work, so don't do it).

If you need to edit main.cf manually, you need to stop VCS

# hastop -all -force   ### stops vcs but leaves resources up. Wouldn't recommend doing this in the middle of the day though.

Then edit the main.cf

Verify the configuration:

# hacf -verify /etc/VRTSvcs/conf/config

Start vcs on the node where you made the edits (or ensure you have copied the changed file to all nodes)

# hastart

once vcs is started, start vcs on the remaining nodes.

***** Suggestion *****

What type of "minor edit" is required? Most changes can be done dynamically with hares/hagrp/haxxxxx -modify

eg: to change a resource attribute

# haconf -makerw

# hares -modify <resource> <attribute> <new_value>

# haconf -dump -makero

The latter method is preferable, obviously, unless it is something that cannot be changed without stopping the daemon.

If this post has helped you, please vote or mark as solution

g_lee's picture

further reading that may be of use:

VCS 6.0 (Solaris) Administrator's Guide: https://sort.symantec.com/public/documents/vcs/6.0...

Section 1: Clustering concepts and terminology -> VCS configuration concepts -> About configuring VCS

https://sort.symantec.com/public/documents/vcs/6.0...

----------
In a VCS cluster, the first system to be brought online reads the configuration file and creates an internal (in-memory) representation of the configuration. Systems that are brought online after the first system derive their information from systems that are in the cluster.

You must stop the cluster if you need to modify the files manually. Changes made by editing the configuration files take effect when the cluster is restarted. The node where you made the changes should be the first node to be brought back online.
----------

and VCS configuration language: https://sort.symantec.com/public/documents/vcs/6.0...

----------
Several ways to generate configuration files are as follows:
• Use the Web-based Veritas Operations Manager.
• Use Cluster Manager (Java Console).
• Use the command-line interface.
• If VCS is not running, use a text editor to create and modify the files.
• Use the VCS simulator on a Windows system to create the files.
----------

pdf version and other assorted VCS guides available here: https://sort.symantec.com/documents/doc_details/vc...

or go to https://sort.symantec.com/documents to pick the correct platform/version combination if different to above.

If this post has helped you, please vote or mark as solution

Rick_Smith's picture

I prefer your method of using hares -

 

Here is what is currently in main.cf:

NotifierMngr notifier (
                SmtpServer = "mailserver.domain.com"
                SmtpReturnPath = "admin@domain.com"
                SmtpFromPath = "admin@domain.com"
                SmtpRecipients = { "admin@domain.com" = Warning,
                         "page-admin@domain.com" = Error }
                )

I need to change admin@domain.com in SmtpReceipents for Error level to xyz@domain.com,

question: do I need to change SmtpReturnPath to the same also and the SmtpFromPath to the same thing? Are they usually the same?

 

So my code looks like this:

haconf -makerw
hares -modify notifier SmtpRecipients xyz@domain.com Error

hares -modify notifier SmtpReturnPath xyz@dmain.com

hares -modify notifier SmtpFromPath xyz@domain.com
hares -modify notifier Enabled 1
haconf -dump -makero
 

 

Dave_Stevens's picture

I could not respond to this post, asking a friend to do so

-Rick

 

I agree with using hares - modify

This is present snippet from main.cf

NotifierMngr notifier (
                SmtpServer = "mailserver.domain.com"
                SmtpReturnPath = "admin@domain.com"
                SmtpFromPath = "admin@domain.com"
                SmtpRecipients = { "admin@domain.com" = Warning,
                         "page-admin@domain.com" = Error }
                )

I need to change admin@domain.com to xyz@domain.com  and page-admin@domain.com to abc@domain.com

This is my code

haconf -makerw

hares -modify notifier SmtpRecipients xyz@domain.com Warning

hares -modify SmtpReceipents abc@domain.com Error
hares -modify notifier SmtpReturnPath xyz@domain.com
hares -modify notifier SmtpFromPath   xyz@domain.com

hares -modify notifier Enabled 1
haconf -dump -makero

will it work???

 

g_lee's picture

SmtpRecipients is an association, so unless using the -add/-update flag, modify both/all the key-value pairs in one step or the first one will be overwritten with the second/last (see hares -help -modify or hares manpage, eg: https://sort.symantec.com/public/documents/sfha/6.... )

so:

# haconf -makerw
# hares -modify notifier SmtpReturnPath xyz@domain.com
# hares -modify notifier SmtpFromPath xyz@domain.com
# hares -modify notifier SmtpRecipients xyz@domain.com Warning abc@domain.com Error
# haconf -dump -makero

The notifier resource is already Enabled, so you don't need to re-enable it (check: # hares -display notifier -attribute Enabled )

If this post has helped you, please vote or mark as solution

SOLUTION