This section describes the process of converting file-based states to Redis states, and the related potential limitations and issues.
For more information about file-based states and Redis states, see States in WEC clustering (file-based states and Redis states).
Conversion steps and limitations
During the conversion process, you move your existing file-based states into Redis states. The WEC binary supports moving the file-based states with a dedicated command line option (-i):
root@ubuntu1:/opt/syslog-ng/var/wecstate# /opt/syslog-ng/libexec/wec -h Usage of /opt/syslog-ng/libexec/wec: -c string Configuration file name (default "/opt/syslog-ng/etc/wec.yaml") -i Initializing shared state from stateDir -s string Persistent state directory (default "/opt/syslog-ng/var/wecstate") -v WEC version
To convert file-based states to Redis states
-
Load your existing file-based states from your stateDir directory.
-
Connect to Redis server.
NOTE: If your Redis server is not available, the WEC will not start at all, and the conversion process stops.
-
Save your previously loaded file-based states into a Redis HSET.
-
Move the files containing your WEC states to your stateDir/.converted folder.
CAUTION: If moving the WEC states to your stateDir/.converted folder is unsuccessful, your file-based state will contain out-of-date data. If the final conversion step is unsuccessful, and you have your -i option enabled, the out-of-date data in your file-based states overwrite the data in your Redis states after your next WEC restart (which results in message duplication). To avoid this, remove the -i command line option before you restart your WEC following your state conversion.
NOTE: If for some reason, your WEC cluster configuration does not work as expected, your previous file-base states will not be available if you delete them. Instead, One Identity recommends moving the files to the folder, where they will be available for recovery if needed.
NOTE: State conversion has two possible results:
-
successful
-
unsuccessful
If any of the state conversion steps is unsuccessful, the WEC instance stops with an error. As a result, even if the file-based state is successfully saved to Redis, but moving the files is unsuccessful, the WEC instance stops and prints an error message:
Failed to move state files, remove it manually
This is an expected behavior, developed to avoid unwanted, huge message duplication and related issues. Instead of message duplication, if the file-based state is converted, but moving the state files is unsuccessful for some reason, you can re-initialize Redis with the state files that contain old bookmarks.
-