From 30f707d36fc47e064f07222633225bba7a5264e3 Mon Sep 17 00:00:00 2001 From: zygisa Date: Tue, 30 Apr 2024 17:43:03 +0300 Subject: [PATCH] Add cluster-port option to redis config file (#496) --- CHANGELOG.md | 2 ++ README.md | 1 + attributes/default.rb | 1 + providers/configure.rb | 1 + templates/default/redis.conf.erb | 1 + 5 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f8fcdff..4d76649a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ This file is used to list changes made in each version of the redisio cookbook. ## Unreleased +- Add option to specify `cluster-port` + ## 7.1.1 - *2024-04-21* - Fix default `tls*` attribute names diff --git a/README.md b/README.md index 992b6ca6..27d638cc 100644 --- a/README.md +++ b/README.md @@ -384,6 +384,7 @@ Available options and their defaults 'clusterenabled' => 'no', 'clusterconfigfile' => nil, # Defaults to redis instance name inside of template if cluster is enabled. 'clusternodetimeout' => 5000, +'clusterport' => nil, 'includes' => nil, 'aclfile' => nil, # Requires redis 6+ 'breadcrumb' => true # Defaults to create breadcrumb lock-file. diff --git a/attributes/default.rb b/attributes/default.rb index 02db245e..fd16ca9a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -142,6 +142,7 @@ 'clusterenabled' => 'no', 'clusterconfigfile' => nil, # Defaults to redis instance name inside of template if cluster is enabled. 'clusternodetimeout' => 5000, + 'clusterport' => nil, 'includes' => nil, 'aclfile' => nil, 'data_bag_name' => nil, diff --git a/providers/configure.rb b/providers/configure.rb index 0f47bb97..51928b14 100644 --- a/providers/configure.rb +++ b/providers/configure.rb @@ -260,6 +260,7 @@ clusterenabled: current['clusterenabled'], clusterconfigfile: current['clusterconfigfile'], clusternodetimeout: current['clusternodetimeout'], + clusterport: current['clusterport'], includes: current['includes'], aclfile: current['aclfile'], minreplicastowrite: current['minreplicastowrite'], diff --git a/templates/default/redis.conf.erb b/templates/default/redis.conf.erb index b8ab66e8..59c58c7e 100644 --- a/templates/default/redis.conf.erb +++ b/templates/default/redis.conf.erb @@ -1033,6 +1033,7 @@ aof-rewrite-incremental-fsync <%= @aofrewriteincrementalfsync %> cluster-enabled yes cluster-config-file <%= @clusterconfigfile || "nodes-#{@name}.conf" %> cluster-node-timeout <%= @clusternodetimeout %> +<%= "cluster-port #{@clusterport}" unless @clusterport.nil? %> <%end%> <% if @version[:major].to_i >= 6 %>