add horizontal file sharding based on filename matches

This commit is contained in:
rootdarkarchon
2022-12-31 14:28:24 +01:00
parent 2a5e505130
commit b6404a9c1d
11 changed files with 72 additions and 21 deletions

View File

@@ -20,7 +20,6 @@ services:
restart: always
ports:
- 6000:6000/tcp
- 6200:6200/tcp
volumes:
- ../config/sharded/haproxy-shards.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
@@ -35,6 +34,10 @@ services:
restart: on-failure
environment:
MareSynchronos__CdnFullUrl: "${DEV_MARE_CDNURL}"
MareSynchronos__CdnShardConfiguration__0__CdnFullUrl: "${DEV_MARE_CDNURL}"
MareSynchronos__CdnShardConfiguration__0__FileMatch: "^[01234567]"
MareSynchronos__CdnShardConfiguration__1__CdnFullUrl: "${DEV_MARE_CDNURL2}"
MareSynchronos__CdnShardConfiguration__1__FileMatch: "^[89ABCDEF]"
volumes:
- ../config/sharded/server-shard-main.json:/opt/MareSynchronosServer/appsettings.json
- ../log/server-shard-main/:/opt/MareSynchronosServer/logs/:rw
@@ -98,6 +101,8 @@ services:
- ../log/files-shard-1/:/opt/MareSynchronosStaticFilesServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
- ../data/files-shard-1/:/marecache/:rw
ports:
- 6200:6200/tcp
depends_on:
- "postgres"
- "mare-files"
@@ -110,6 +115,8 @@ services:
- ../log/files-shard-2/:/opt/MareSynchronosStaticFilesServer/logs/:rw
- postgres_socket:/var/run/postgresql/:rw
- ../data/files-shard-2/:/marecache/:rw
ports:
- 6201:6200/tcp
depends_on:
- "postgres"
- "mare-files"

View File

@@ -23,17 +23,8 @@ frontend mare
bind :6000
default_backend mare-servers
frontend mare-files
bind :6200
default_backend mare-files
backend mare-servers
balance leastconn
cookie SERVER insert indirect nocache
server mare1 mare-shard-1:6000 cookie mare1
server mare2 mare-shard-2:6000 cookie mare2
backend mare-files
balance roundrobin
server files1 mare-files-shard-1:6200
server files2 mare-files-shard-2:6200

View File

@@ -41,7 +41,17 @@
"MaxJoinedGroupsByUser": 6,
"MaxGroupUserCount": 100,
"PurgeUnusedAccounts": false,
"PurgeUnusedAccountsPeriodInDays": 14
"PurgeUnusedAccountsPeriodInDays": 14,
"CdnShardConfiguration": [
{
"FileMatch": "^[01234567]",
"CdnFullUrl": ""
},
{
"FileMatch": "^[89ABCDEF]",
"CdnFullUrl": ""
}
]
},
"AllowedHosts": "*",
"Kestrel": {