Supported Platforms
Example: Configuring Junos OS Batch Commits
Junos OS Batch Commits Overview
Junos OS provides a batch commit feature that aggregates or merges multiple configuration edits from different CLI sessions or users and adds them to a batch commit queue. A batch commit server running on the device takes one or more jobs from the batch commit queue, applies the configuration changes to the shared configuration database, and then commits the configuration changes in a single commit operation.
Batches are prioritized by the commit server based on priority of the batch specified by the user or the time when the batch job is added. When one batch commit is complete, the next set of configuration changes are aggregated and loaded into the batch queue for the next session of the batch commit operation. Batches are created until there are no commit entries left in the queue directory.
When compared to the regular commit operation where all commits are independently committed sequentially, batch commits save time and system resources by committing multiple small configuration edits in a single commit operation.
Batch commits are performed from the [edit batch] configuration mode. The commit server properties can be configured at the [edit system commit server] hierarchy level.
Aggregation and Error Handling
When there is a load-time error in one of the aggregated jobs, the commit job that encounters the error is discarded and the remaining jobs are aggregated and committed.
For example, if there are five commit jobs (commit-1, commit-2, commit-3, commit-4, and commit-5) being aggregated, and commit-3 encounters an error while loading, commit-3 is discarded and commit-1, commit-2, commit-4, and commit-5 are aggregated and committed.
If there is an error during the commit operation when two or more jobs are aggregated and committed, the aggregation is discarded and each of those jobs is committed individually like a regular commit operation.
For example, if there are five commit jobs (commit-1, commit-2, commit-3, commit-4, and commit-5) that are aggregated and if there is a commit error caused because of commit-3, the aggregation is discarded, commit-1, commit-2, commit-3, commit-4, and commit-5 are committed individually, and the CLI reports a commit error for commit-3.
Example: Configuring Batch Commit Server Properties
This example shows how to configure batch commit server properties to manage batch commit operations.
Requirements
This example uses the following hardware and software components:
- MX Series 3D Universal Edge Router
- Junos OS Release 12.1 or later running on the device
Overview
You can control how the batch commit queue is handled by the commit server by configuring the server properties at the [edit system commit server] hierarchy level. This enables you to control how many commit jobs are aggregated or merged into a single batch commit, the maximum number of jobs that can be added to the queue, days to keep batch commit error logs, interval between two batch commits, and tracing operations for batch commit operations.
Configuration
CLI Quick Configuration
To quickly configure this section of the example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level. You can configure the commit server properties from either the regular [edit] mode or the [edit batch] mode.
Device R0
Configuring the Commit Server Properties
Step-by-Step Procedure
- (Optional) Configure the number of commit transactions
to aggregate or merge in a single commit operation.
The default value for maximum-aggregate-pool is 5.
Note: Setting maximum-aggregate-pool to 1 commits each of the jobs individually.
In this example, the number of commit transactions is set to 4 indicating that four different commit jobs are aggregated into a single commit before the commit operation is initiated.
[edit system commit server]user@R0# set maximum-aggregate-pool 4 - (Optional) Configure the maximum number of jobs allowed
in a batch.
This limits the number of commits jobs that are added to the queue.
[edit system commit server]user@R0# set maximum-entries 500Note: If you set maximum-entries to 1, the commit server cannot add more than one job to the queue, and the CLI displays an appropriate message when you try to commit more than one job.
- (Optional) Configure the time (in seconds) to wait before
starting the next batch commit operation.[edit system commit server]user@R0# set commit-interval 5
- (Optional) Configure the number of days to keep error
logs.
The default value is 30 days.
[edit system commit server]user@R0# set days-to-keep-error-logs 30 - (Optional) Configure tracing operations to log batch commit
events.
In this example, the filename for logging batch commit events is commitd_nov, and all traceoption flags are set.
[edit system commit server]user@R0# set traceoptions commitd_novuser@R0# set traceoptions flag all
Results
From configuration mode, confirm your configuration by entering the show system commit server command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Committing the Configuration from Batch Configuration Mode
Step-by-Step Procedure
To commit the configuration from the [edit batch] mode, do one of the following:
- Log in to the device and enter commit.[edit batch]user@R0# commit
Added to commit queue request-id: 1000
- To assign a higher priority to a batch commit job, issue
the commit command with the priority option.[edit batch]user@R0# commit priority
Added to commit queue request-id: 1001
- To commit a configuration without aggregating the configuration
changes with other commit jobs in the queue, issue the commit command with the atomic option.[edit batch]user@R0# commit atomic
Added to commit queue request-id: 1002
- To commit a configuration without aggregating the configuration
changes with other commit jobs in the queue, and issuing a higher
priority to the commit job, issue the commit command with
the atomic priority option.[edit batch]user@R0# commit atomic priority
Added to commit queue request-id: 1003
Verification
Confirm that the configuration is working properly.
- Checking the Batch Commit Server Status
- Checking the Batch Commit Status
- Viewing the Patch Files in a Batch Commit Job
- Viewing the Trace Files for Batch Commit Operations
Checking the Batch Commit Server Status
Purpose
Check the status of the batch commit server.
Action
user@R0> show system commit server
Commit server status : Not running
By default, the status of the commit server is Not running. The commit server starts running only when a batch commit job is added to the queue.
When a batch commit job is added to the queue, the status of the commit server changes to Running.
user@R0> show system commit server
Commit server status : Running Jobs in process: 1003 1004 1005
Meaning
The Jobs in process field lists the commit IDs of jobs that are in process.
Checking the Batch Commit Status
Purpose
Check the commit server queue for the status of the batch commits.
Action
user@R0> show system commit server queue
Pending commits: Id: 1005 Last Modified: Tue Nov 1 23:56:43 2011 Completed commits: Id: 1000 Last Modified: Tue Nov 1 22:46:43 2011 Status: Successfully committed 1000 Id: 1002 Last Modified: Tue Nov 1 22:50:35 2011 Status: Successfully committed 1002 Id: 1004 Last Modified: Tue Nov 1 22:51:48 2011 Status: Successfully committed 1004 Id: 1007 Last Modified: Wed Nov 2 01:08:04 2011 Status: Successfully committed 1007 Id: 1009 Last Modified: Wed Nov 2 01:16:45 2011 Status: Successfully committed 1009 Id: 1010 Last Modified: Wed Nov 2 01:19:25 2011 Status: Successfully committed 1010 Id: 1011 Last Modified: Wed Nov 2 01:28:16 2011 Status: Successfully committed 1011 Error commits: Id: 1008 Last Modified: Wed Nov 2 01:08:18 2011 Status: Error while commiting 1008
Meaning
Pending commits displays commit jobs that are added to the commit queue but are not committed yet. Completed commits displays the list of commit jobs that are successful. Error commits are commits that failed because of an error.
Viewing the Patch Files in a Batch Commit Job
Purpose
View the timestamps, patch files, and the status of each of the commit jobs. Patch files show the configuration changes that occur in each commit operation that is added to the batch commit queue.
Action
- Issue the show system commit server queue patch command to view the patches for all commit operations.
user@R0> show system commit server queue patch
Pending commits: none Completed commits: Id: 1000 Last Modified: Tue Nov 1 22:46:43 2011 Status: Successfully committed 1000 Patch: [edit groups] re1 { ... } + GRP-DHCP-POOL-NOACCESS { + access { + address-assignment { + pool <*> { + family inet { + dhcp-attributes { + maximum-lease-time 300; + grace-period 300; + domain-name verizon.net; + name-server { + 4.4.4.1; + 4.4.4.2; + } + } + } + } + } + } + } Id: 1002 Last Modified: Tue Nov 1 22:50:35 2011 Status: Successfully committed 1002 Patch: [edit] + snmp { + community abc; + } Id: 1010 Last Modified: Wed Nov 2 01:19:25 2011 Status: Successfully committed 1010 Patch: [edit system syslog] file test { ... } + file j { + any any; + } Error commits: Id: 1008 Last Modified: Wed Nov 2 01:08:18 2011 Status: Error while commiting 1008 Patch: [edit system] + radius-server { + 10.1.1.1 port 222; + }
The output shows the changes in configuration for each commit job ID.
- To view the patch for a specific commit job ID, issue
the show system commit server queue patch id <id-number> command.
user@R0> show system commit server queue patch id 1000
Completed commits: Id: 1000 Last Modified: Tue Nov 1 22:46:43 2011 Status: Successfully committed 1000 Patch: [edit system] + radius-server { + 192.168.69.162 secret teH.bTc/RVbPM; + 192.168.64.10 secret teH.bTc/RVbPM; + 192.168.60.52 secret teH.bTc/RVbPM; + 192.168.60.55 secret teH.bTc/RVbPM; + 192.168.4.240 secret teH.bTc/RVbPM; + }
Meaning
The output shows the patch created for a commit job. The + or - sign indicates the changes in the configuration for a specific commit job.
Viewing the Trace Files for Batch Commit Operations
Purpose
View the trace files for batch commit operations. You can use the trace files for troubleshooting purposes.
Action
- Issue the file show /var/log/<filename> command to view all entries in the log file.
user@R0> file show/var/log/commitd_nov
The output shows commit server event logs and other logs for batch commits.
Nov 1 22:46:43 Successfully committed 1000 Nov 1 22:46:43 pausing after commit for 0 seconds ... Nov 1 22:46:43 Done working on queue ... Nov 1 22:47:17 maximum-aggregate-pool = 5 Nov 1 22:47:17 maximum-entries= 0 Nov 1 22:47:17 asynchronous-prompt = no Nov 1 22:47:17 commit-interval = 0 Nov 1 22:47:17 days-to-keep-error-logs = -1 ... Nov 1 22:47:17 Added to commit queue request-id: 1001 Nov 1 22:47:17 Commit server status=running Nov 1 22:47:17 No need to pause ... Nov 1 22:47:18 Error while commiting 1001 Nov 1 22:47:18 doing rollback ...
- To view log entries only for successful batch commit operations,
issue the file show /var/log/<filename> command with the | match committed pipe option.
user@R0> file show/var/log/commitd_nov | match committed
The output shows batch commit job IDs for successful commit operations.
Nov 1 22:46:43 Successfully committed 1000 Nov 1 22:50:35 Successfully committed 1002 Nov 1 22:51:48 Successfully committed 1004 Nov 2 01:08:04 Successfully committed 1007 Nov 2 01:16:45 Successfully committed 1009 Nov 2 01:19:25 Successfully committed 1010 Nov 2 01:28:16 Successfully committed 1011
- To view log entries only for failed batch commit operations,
issue the file show /var/log/<filename> command with the | match “Error while” pipe option.
user@R0> file show/var/log/commitd_nov | match “Error while”
The output shows commit job IDs for failed commit operations.
Nov 1 22:47:18 Error while commiting 1001 Nov 1 22:51:10 Error while commiting 1003 Nov 1 22:52:15 Error while commiting 1005 ...
- To view log entries only for commit server events, issue
the file show /var/log/<filename> command with the | match “commit server” pipe
option.
user@R0> file show/var/log/commitd_nov | match “commit server”
The output shows commit server event logs.
Nov 1 22:46:39 Commit server status=running Nov 1 22:46:39 Commit server jobs=1000 Nov 1 22:46:43 Commit server status=not running Nov 1 22:46:43 Commit server jobs= Nov 1 22:47:17 Commit server status=running Nov 1 22:47:18 Commit server jobs=1001 Nov 1 22:47:18 2 errors reported by commit server Nov 1 22:47:18 Commit server status=not running Nov 1 22:47:18 Commit server jobs= Nov 1 22:50:31 Commit server status=running Nov 1 22:50:31 Commit server jobs=1002 Nov 1 22:50:35 Commit server status=not running Nov 1 22:50:35 Commit server jobs= Nov 1 22:51:09 Commit server status=running Nov 1 22:51:10 Commit server jobs=1003 Nov 1 22:51:10 2 errors reported by commit server Nov 1 22:51:10 Commit server status=not running ...