Skip to content

Commit

Permalink
Merge pull request #11 from cdivita/replication-and-logging
Browse files Browse the repository at this point in the history
Replication and logging
  • Loading branch information
lfeldman authored Oct 19, 2021
2 parents 6d00de4 + 6d392f0 commit fa98601
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
15 changes: 15 additions & 0 deletions dynamic_group.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "random_id" "dynamic_group" {
byte_length = 2
}

resource "oci_identity_dynamic_group" "redis_dynamic_group" {

provider = oci.homeregion

compartment_id = var.tenancy_ocid

name = "redis-cluster-dynamic-group-${random_id.dynamic_group.hex}"
description = "Dynamic group of Redis cluster Compute instances"

matching_rule = "tag.${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}.value = '${var.release}'"
}
58 changes: 58 additions & 0 deletions redis_logging.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
resource "oci_logging_log_group" "redis_log_group" {

compartment_id = var.compartment_ocid
display_name = "Redis Log Group"
}

resource "oci_logging_log" "redis_log" {

display_name = "Redis Logs"

is_enabled = true
log_group_id = oci_logging_log_group.redis_log_group.id
log_type = "CUSTOM"
retention_duration = "30"
}

resource "oci_logging_unified_agent_configuration" "redis_log_agent_config" {

compartment_id = var.compartment_ocid

description = "Log Agent configuration for Redis nodes"
display_name = "redis-log-agent-config"

group_association {
group_list = [
oci_identity_dynamic_group.redis_dynamic_group.id
]
}

is_enabled = true

service_configuration {

configuration_type = "LOGGING"

destination {
log_object_id = oci_logging_log.redis_log.id
}

sources {

name = "redis_server"

parser {

parser_type = "REGEXP"
expression = "^(?<pid>\\d+):(?<role>[XCSM]) (?<time>[^\\]]*) (?<level>[\\.\\-\\*\\#]) (?<message>.+)$"
time_format = "%d %B %Y %H:%M:%S.%L"
}

paths = [
"/tmp/redis-server.log"
]

source_type = "LOG_TAIL"
}
}
}
1 change: 1 addition & 0 deletions scripts/redis_bootstrap_master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cluster-node-timeout 5000
cluster-slave-validity-factor 0
appendonly yes
requirepass ${redis_password}
masterauth ${redis_password}
EOF

# Configure Sentinel
Expand Down
2 changes: 1 addition & 1 deletion scripts/redis_bootstrap_replica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ cluster-node-timeout 5000
cluster-slave-validity-factor 0
appendonly yes
requirepass ${redis_password}
masterauth ${redis_password}
EOF


sleep 30
#/usr/local/bin/redis-server $REDIS_CONFIG_FILE --daemonize yes
#nohup /usr/local/bin/redis-server $REDIS_CONFIG_FILE > /tmp/redis-server.log &

0 comments on commit fa98601

Please sign in to comment.