334 строки
14 KiB
JSON
334 строки
14 KiB
JSON
{
|
|
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"adminUsername": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"Description": "Administrator user name used when provisioning virtual machines"
|
|
}
|
|
},
|
|
"adminPassword": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"Description": "Administrator password used when provisioning virtual machines"
|
|
}
|
|
},
|
|
"storageAccountName": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"metadata": {
|
|
"Description": "Unique namespace for the Storage Account where the Virtual Machine's disks will be placed"
|
|
}
|
|
},
|
|
"region": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"Description": "Location where resources will be provisioned"
|
|
}
|
|
},
|
|
"virtualNetworkName": {
|
|
"type": "string",
|
|
"defaultValue": "redisVirtNet",
|
|
"metadata": {
|
|
"Description": "The arbitrary name of the virtual network provisioned for the Redis cluster"
|
|
}
|
|
},
|
|
"addressPrefix": {
|
|
"type": "string",
|
|
"defaultValue": "10.0.0.0/16",
|
|
"metadata": {
|
|
"Description": "The network address space for the virtual network"
|
|
}
|
|
},
|
|
"subnetName": {
|
|
"type": "string",
|
|
"defaultValue": "redisSubnet1",
|
|
"metadata": {
|
|
"Description": "Subnet name for the virtual network that resources will be provisioned in to"
|
|
}
|
|
},
|
|
"subnetPrefix": {
|
|
"type": "string",
|
|
"defaultValue": "10.0.0.0/24",
|
|
"metadata": {
|
|
"Description": "Address space for the virtual network subnet"
|
|
}
|
|
},
|
|
"nodeAddressPrefix": {
|
|
"type": "string",
|
|
"defaultValue": "10.0.0.1",
|
|
"metadata": {
|
|
"Description": "The IP address prefix that will be used for constructing a static private IP address for each node in the cluster"
|
|
}
|
|
},
|
|
"jumpbox": {
|
|
"type": "string",
|
|
"defaultValue": "Disabled",
|
|
"allowedValues": [
|
|
"Enabled",
|
|
"Disabled"
|
|
],
|
|
"metadata": {
|
|
"Description": "The flag allowing to enable or disable provisioning of the jumpbox VM that can be used to access the Redis nodes"
|
|
}
|
|
},
|
|
"tshirtSize": {
|
|
"type": "string",
|
|
"defaultValue": "Small",
|
|
"allowedValues": [
|
|
"Small",
|
|
"Medium",
|
|
"Large"
|
|
],
|
|
"metadata": {
|
|
"Description": "T-shirt size of the Redis deployment"
|
|
}
|
|
},
|
|
"redisVersion": {
|
|
"type": "string",
|
|
"defaultValue": "stable",
|
|
"metadata": {
|
|
"Description": "The version of the Redis package to be deployed on the cluster (or use 'stable' to pull in the latest and greatest)"
|
|
}
|
|
},
|
|
"redisClusterName": {
|
|
"type": "string",
|
|
"defaultValue": "redis-cluster",
|
|
"metadata": {
|
|
"Description": "The arbitrary name of the Redis cluster"
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"_comment0": "/* T-shirt sizes may vary for different reasons, and some customers may want to modify these - so feel free to go ahead and define your favorite t-shirts */",
|
|
"tshirtSizeSmall": {
|
|
"vmSizeMember": "Standard_A1",
|
|
"numberOfMasters": 3,
|
|
"numberOfSlaves": 0,
|
|
"totalMemberCount": 3,
|
|
"totalMemberCountExcludingLast": 2,
|
|
"vmTemplate": "[concat(variables('templateBaseUrl'), 'node-resources.json')]"
|
|
},
|
|
"tshirtSizeMedium": {
|
|
"vmSizeMember": "Standard_A2",
|
|
"numberOfMasters": 3,
|
|
"numberOfSlaves": 3,
|
|
"totalMemberCount": 6,
|
|
"totalMemberCountExcludingLast": 5,
|
|
"vmTemplate": "[concat(variables('templateBaseUrl'), 'node-resources.json')]"
|
|
},
|
|
"tshirtSizeLarge": {
|
|
"vmSizeMember": "Standard_A5",
|
|
"numberOfMasters": 3,
|
|
"numberOfSlaves": 6,
|
|
"totalMemberCount": 9,
|
|
"totalMemberCountExcludingLast": 8,
|
|
"arbiter": "Enabled",
|
|
"vmTemplate": "[concat(variables('templateBaseUrl'), 'node-resources.json')]"
|
|
},
|
|
"osFamilyUbuntu": {
|
|
"imagePublisher": "Canonical",
|
|
"imageOffer": "UbuntuServer",
|
|
"imageSKU": "14.04.2-LTS"
|
|
},
|
|
"vmStorageAccountContainerName": "vhd-redis",
|
|
"vmStorageAccountDomain": ".blob.core.windows.net",
|
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
|
|
"scriptUrl": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/redis-high-availability/",
|
|
"templateBaseUrl": "[variables('scriptUrl')]",
|
|
"jumpboxTemplateEnabled": "jumpbox-resources.json",
|
|
"jumpboxTemplateDisabled": "empty-resources.json",
|
|
"sharedTemplateUrl": "[concat(variables('templateBaseUrl'), 'shared-resources.json')]",
|
|
"jumpboxTemplateUrl": "[concat(variables('templateBaseUrl'), variables(concat('jumpboxTemplate', parameters('jumpbox'))))]",
|
|
"commonSettings": {
|
|
"availabilitySetName": "redisAvailSet",
|
|
"region": "[parameters('region')]"
|
|
},
|
|
"storageSettings": {
|
|
"vhdStorageAccountName": "[parameters('storageAccountName')]",
|
|
"vhdContainerName": "[variables('vmStorageAccountContainerName')]",
|
|
"destinationVhdsContainer": "[concat('https://', parameters('storageAccountName'), variables('vmStorageAccountDomain'), '/', variables('vmStorageAccountContainerName'), '/')]"
|
|
},
|
|
"networkSettings": {
|
|
"virtualNetworkName": "[parameters('virtualNetworkName')]",
|
|
"addressPrefix": "[parameters('addressPrefix')]",
|
|
"subnetName": "[parameters('subnetName')]",
|
|
"subnetPrefix": "[parameters('subnetPrefix')]",
|
|
"subnetRef": "[concat(variables('vnetID'), '/subnets/', parameters('subnetName'))]",
|
|
"machineIpPrefix": "[parameters('nodeAddressPrefix')]"
|
|
},
|
|
"machineSettings": {
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"machineNamePrefix": "redisnode-",
|
|
"osImageReference": {
|
|
"publisher": "[variables('osFamilyUbuntu').imagePublisher]",
|
|
"offer": "[variables('osFamilyUbuntu').imageOffer]",
|
|
"sku": "[variables('osFamilyUbuntu').imageSKU]",
|
|
"version": "latest"
|
|
}
|
|
},
|
|
"clusterSpec": "[variables(concat('tshirtSize', parameters('tshirtSize')))]",
|
|
"installCommand": "[concat('redis-cluster-install.sh -n ', parameters('redisClusterName'), ' -v ', parameters('redisVersion'), ' -c ', variables('clusterSpec').totalMemberCount, ' -m ', variables('clusterSpec').numberOfMasters, ' -s ', variables('clusterSpec').numberOfSlaves, ' -p ', variables('networkSettings').machineIpPrefix)]",
|
|
"vmScripts": {
|
|
"scriptsToDownload": [
|
|
"[concat(variables('scriptUrl'), 'redis-cluster-install.sh')]",
|
|
"[concat(variables('scriptUrl'), 'redis-cluster-setup.sh')]",
|
|
"[concat(variables('scriptUrl'), 'redis-sentinel-startup.sh')]"
|
|
],
|
|
"installCommand": "[concat('bash ', variables('installCommand'))]",
|
|
"setupCommand": "[concat('bash ', variables('installCommand'), ' -l')]"
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"name": "shared-resources",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "2015-01-01",
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[variables('sharedTemplateUrl')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"commonSettings": {
|
|
"value": "[variables('commonSettings')]"
|
|
},
|
|
"storageSettings": {
|
|
"value": "[variables('storageSettings')]"
|
|
},
|
|
"networkSettings": {
|
|
"value": "[variables('networkSettings')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "jumpbox-resources",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "2015-01-01",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Resources/deployments/', 'shared-resources')]"
|
|
],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[variables('jumpboxTemplateUrl')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"commonSettings": {
|
|
"value": "[variables('commonSettings')]"
|
|
},
|
|
"storageSettings": {
|
|
"value": "[variables('storageSettings')]"
|
|
},
|
|
"networkSettings": {
|
|
"value": "[variables('networkSettings')]"
|
|
},
|
|
"machineSettings": {
|
|
"value": "[variables('machineSettings')]"
|
|
},
|
|
"adminPassword": {
|
|
"value": "[parameters('adminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Resources/deployments",
|
|
"name": "[concat('node-resources', copyindex())]",
|
|
"apiVersion": "2015-01-01",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Resources/deployments/', 'shared-resources')]"
|
|
],
|
|
"copy": {
|
|
"name": "memberNodesLoop",
|
|
"count": "[variables('clusterSpec').totalMemberCountExcludingLast]"
|
|
},
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[variables('clusterSpec').vmTemplate]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"commonSettings": {
|
|
"value": "[variables('commonSettings')]"
|
|
},
|
|
"storageSettings": {
|
|
"value": "[variables('storageSettings')]"
|
|
},
|
|
"networkSettings": {
|
|
"value": "[variables('networkSettings')]"
|
|
},
|
|
"machineSettings": {
|
|
"value": {
|
|
"adminUsername": "[variables('machineSettings').adminUsername]",
|
|
"machineNamePrefix": "[variables('machineSettings').machineNamePrefix]",
|
|
"osImageReference": "[variables('machineSettings').osImageReference]",
|
|
"vmSize": "[variables('clusterSpec').vmSizeMember]",
|
|
"machineIndex": "[copyindex()]",
|
|
"vmScripts": "[variables('vmScripts').scriptsToDownload]",
|
|
"commandToExecute": "[concat(variables('vmScripts').installCommand, ' -i ', copyindex())]"
|
|
}
|
|
},
|
|
"adminPassword": {
|
|
"value": "[parameters('adminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "lastnode-resources",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "2015-01-01",
|
|
"dependsOn": [
|
|
"memberNodesLoop"
|
|
],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[variables('clusterSpec').vmTemplate]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"commonSettings": {
|
|
"value": "[variables('commonSettings')]"
|
|
},
|
|
"storageSettings": {
|
|
"value": "[variables('storageSettings')]"
|
|
},
|
|
"networkSettings": {
|
|
"value": "[variables('networkSettings')]"
|
|
},
|
|
"machineSettings": {
|
|
"value": {
|
|
"adminUsername": "[variables('machineSettings').adminUsername]",
|
|
"machineNamePrefix": "[variables('machineSettings').machineNamePrefix]",
|
|
"osImageReference": "[variables('machineSettings').osImageReference]",
|
|
"vmSize": "[variables('clusterSpec').vmSizeMember]",
|
|
"machineIndex": "[variables('clusterSpec').totalMemberCountExcludingLast]",
|
|
"vmScripts": "[variables('vmScripts').scriptsToDownload]",
|
|
"commandToExecute": "[concat(variables('vmScripts').setupCommand, ' -i ', variables('clusterSpec').totalMemberCountExcludingLast)]"
|
|
}
|
|
},
|
|
"adminPassword": {
|
|
"value": "[parameters('adminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"outputs": {
|
|
"installCommand": {
|
|
"value": "[variables('vmScripts').installCommand]",
|
|
"type": "string"
|
|
},
|
|
"setupCommand": {
|
|
"value": "[variables('vmScripts').setupCommand]",
|
|
"type": "string"
|
|
}
|
|
}
|
|
} |