-
Notifications
You must be signed in to change notification settings - Fork 947
actualize Vagrant and fix problems on orchestrator-agent api with sqlite backend #445
Changes from all commits
680e355
8bb825b
57a5f28
17f5a32
9d9dde5
2d1b5d9
c96b2fb
3c4a64f
fe728b3
989017b
212e76f
9fbf9f7
0c9a7d0
b2e2de0
9c21c33
d55d468
3920ea3
43e0184
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,7 @@ function oinstall() { | |
| cd $mydir | ||
| gofmt -s -w go/ | ||
| rsync -qa ./resources $builddir/orchestrator${prefix}/orchestrator/ | ||
| rsync -qa ./conf/orchestrator-sample.* $builddir/orchestrator${prefix}/orchestrator/ | ||
| rsync -qa ./conf/orchestrator-sample*.conf.json $builddir/orchestrator${prefix}/orchestrator/ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| cp etc/init.d/orchestrator.bash $builddir/orchestrator/etc/init.d/orchestrator | ||
| chmod +x $builddir/orchestrator/etc/init.d/orchestrator | ||
| } | ||
|
|
@@ -134,12 +134,14 @@ function package() { | |
| esac | ||
|
|
||
| echo "---" | ||
| if cat /etc/centos-release | grep 'CentOS release 6' ; then | ||
| rm ${TOPDIR:-?}/orchestrator*.deb | ||
| rm ${TOPDIR:-?}/orchestrator*.tar.gz | ||
| # n CentOD 6 box: we only want the rpms for CentOS6 | ||
| # Add "-centos6" to the file name. | ||
| ls ${TOPDIR:-?}/*.rpm | while read f; do centos_file=$(echo $f | sed -r -e "s/^(.*)-${RELEASE_VERSION}(.*)/\1-centos6-${RELEASE_VERSION}\2/g") ; mv $f $centos_file ; done | ||
| if [[ -f /etc/centos-release ]]; then | ||
| if cat /etc/centos-release | grep 'CentOS release 6' ; then | ||
| rm ${TOPDIR:-?}/orchestrator*.deb | ||
| rm ${TOPDIR:-?}/orchestrator*.tar.gz | ||
| # n CentOD 6 box: we only want the rpms for CentOS6 | ||
| # Add "-centos6" to the file name. | ||
| ls ${TOPDIR:-?}/*.rpm | while read f; do centos_file=$(echo $f | sed -r -e "s/^(.*)-${RELEASE_VERSION}(.*)/\1-centos6-${RELEASE_VERSION}\2/g") ; mv $f $centos_file ; done | ||
| fi | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| fi | ||
| echo "Done. Find releases in $TOPDIR" | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| { | ||
| "Debug": true, | ||
| "EnableSyslog": false, | ||
| "ListenAddress": ":3000", | ||
| "MySQLTopologyUser": "orc_client_user", | ||
| "MySQLTopologyPassword": "orc_client_password", | ||
| "MySQLTopologyCredentialsConfigFile": "", | ||
| "MySQLTopologySSLPrivateKeyFile": "", | ||
| "MySQLTopologySSLCertFile": "", | ||
| "MySQLTopologySSLCAFile": "", | ||
| "MySQLTopologySSLSkipVerify": true, | ||
| "MySQLTopologyUseMutualTLS": false, | ||
| "BackendDB": "sqlite", | ||
| "SQLite3DataFile": "/usr/local/orchestrator/orchestrator.sqlite3", | ||
| "DefaultInstancePort": 3306, | ||
| "DiscoverByShowSlaveHosts": true, | ||
| "InstancePollSeconds": 5, | ||
| "UnseenInstanceForgetHours": 240, | ||
| "SnapshotTopologiesIntervalHours": 0, | ||
| "InstanceBulkOperationsWaitTimeoutSeconds": 10, | ||
| "HostnameResolveMethod": "default", | ||
| "MySQLHostnameResolveMethod": "@@hostname", | ||
| "SkipBinlogServerUnresolveCheck": true, | ||
| "ExpiryHostnameResolvesMinutes": 60, | ||
| "RejectHostnameResolvePattern": "", | ||
| "ReasonableReplicationLagSeconds": 10, | ||
| "ProblemIgnoreHostnameFilters": [], | ||
| "VerifyReplicationFilters": false, | ||
| "ReasonableMaintenanceReplicationLagSeconds": 20, | ||
| "CandidateInstanceExpireMinutes": 60, | ||
| "AuditLogFile": "", | ||
| "AuditToSyslog": false, | ||
| "RemoveTextFromHostnameDisplay": ".mydomain.com:3306", | ||
| "ReadOnly": false, | ||
| "AuthenticationMethod": "", | ||
| "HTTPAuthUser": "", | ||
| "HTTPAuthPassword": "", | ||
| "AuthUserHeader": "", | ||
| "PowerAuthUsers": [ | ||
| "*" | ||
| ], | ||
| "ClusterNameToAlias": { | ||
| "127.0.0.1": "test suite" | ||
| }, | ||
| "SlaveLagQuery": "", | ||
| "DetectClusterAliasQuery": "SELECT SUBSTRING_INDEX(@@hostname, '.', 1)", | ||
| "DetectClusterDomainQuery": "", | ||
| "DetectInstanceAliasQuery": "", | ||
| "DetectPromotionRuleQuery": "", | ||
| "DataCenterPattern": "[.]([^.]+)[.][^.]+[.]mydomain[.]com", | ||
| "PhysicalEnvironmentPattern": "[.]([^.]+[.][^.]+)[.]mydomain[.]com", | ||
| "PromotionIgnoreHostnameFilters": [], | ||
| "DetectSemiSyncEnforcedQuery": "", | ||
| "ServeAgentsHttp": false, | ||
| "AgentsServerPort": ":3001", | ||
| "AgentsUseSSL": false, | ||
| "AgentsUseMutualTLS": false, | ||
| "AgentSSLSkipVerify": false, | ||
| "AgentSSLPrivateKeyFile": "", | ||
| "AgentSSLCertFile": "", | ||
| "AgentSSLCAFile": "", | ||
| "AgentSSLValidOUs": [], | ||
| "UseSSL": false, | ||
| "UseMutualTLS": false, | ||
| "SSLSkipVerify": false, | ||
| "SSLPrivateKeyFile": "", | ||
| "SSLCertFile": "", | ||
| "SSLCAFile": "", | ||
| "SSLValidOUs": [], | ||
| "URLPrefix": "", | ||
| "StatusEndpoint": "/api/status", | ||
| "StatusSimpleHealth": true, | ||
| "StatusOUVerify": false, | ||
| "AgentPollMinutes": 60, | ||
| "UnseenAgentForgetHours": 6, | ||
| "StaleSeedFailMinutes": 60, | ||
| "SeedAcceptableBytesDiff": 8192, | ||
| "PseudoGTIDPattern": "", | ||
| "PseudoGTIDPatternIsFixedSubstring": false, | ||
| "PseudoGTIDMonotonicHint": "asc:", | ||
| "DetectPseudoGTIDQuery": "", | ||
| "BinlogEventsChunkSize": 10000, | ||
| "SkipBinlogEventsContaining": [], | ||
| "ReduceReplicationAnalysisCount": true, | ||
| "FailureDetectionPeriodBlockMinutes": 60, | ||
| "RecoveryPeriodBlockSeconds": 3600, | ||
| "RecoveryIgnoreHostnameFilters": [], | ||
| "RecoverMasterClusterFilters": [ | ||
| "_master_pattern_" | ||
| ], | ||
| "RecoverIntermediateMasterClusterFilters": [ | ||
| "_intermediate_master_pattern_" | ||
| ], | ||
| "OnFailureDetectionProcesses": [ | ||
| "echo 'Detected {failureType} on {failureCluster}. Affected replicas: {countSlaves}' >> /tmp/recovery.log" | ||
| ], | ||
| "PreFailoverProcesses": [ | ||
| "echo 'Will recover from {failureType} on {failureCluster}' >> /tmp/recovery.log" | ||
| ], | ||
| "PostFailoverProcesses": [ | ||
| "echo '(for all types) Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log" | ||
| ], | ||
| "PostUnsuccessfulFailoverProcesses": [], | ||
| "PostMasterFailoverProcesses": [ | ||
| "echo 'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Promoted: {successorHost}:{successorPort}' >> /tmp/recovery.log" | ||
| ], | ||
| "PostIntermediateMasterFailoverProcesses": [ | ||
| "echo 'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log" | ||
| ], | ||
| "CoMasterRecoveryMustPromoteOtherCoMaster": true, | ||
| "DetachLostSlavesAfterMasterFailover": true, | ||
| "ApplyMySQLPromotionAfterMasterFailover": false, | ||
| "MasterFailoverDetachSlaveMasterHost": false, | ||
| "MasterFailoverLostInstancesDowntimeMinutes": 0, | ||
| "PostponeSlaveRecoveryOnLagMinutes": 0, | ||
| "OSCIgnoreHostnameFilters": [], | ||
| "GraphiteAddr": "", | ||
| "GraphitePath": "", | ||
| "GraphiteConvertHostnameDotsToUnderscores": true | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,9 +54,11 @@ start_daemon () { | |
| post_start_daemon_hook 1>&2 | ||
| } | ||
|
|
||
| # The file /etc/orchestrator_profile can be used to inject pre-service execution | ||
| # This files can be used to inject pre-service execution | ||
| # scripts, such as exporting variables or whatever. It's yours! | ||
| [ -f /etc/default/orchestrator ] && . /etc/default/orchestrator | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please explain why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /etc/default it's a default behavion on debian based distributives
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i add usage
|
||
| [ -f /etc/orchestrator_profile ] && . /etc/orchestrator_profile | ||
| [ -f /etc/profile.d/orchestrator ] && . /etc/profile.d/orchestrator | ||
|
|
||
| case "$1" in | ||
| start) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,9 +106,9 @@ func SubmitAgent(hostname string, port int, token string) (string, error) { | |
| _, err := db.ExecOrchestrator(` | ||
| replace | ||
| into host_agent ( | ||
| hostname, port, token, last_submitted | ||
| hostname, port, token, last_submitted, count_mysql_snapshots | ||
| ) VALUES ( | ||
| ?, ?, ?, NOW() | ||
| ?, ?, ?, NOW(), 0 | ||
| ) | ||
| `, | ||
| hostname, | ||
|
|
@@ -164,7 +164,7 @@ func ReadOutdatedAgentsHosts() ([]string, error) { | |
| from | ||
| host_agent | ||
| where | ||
| IFNULL(last_checked < now() - interval ? minute, true) | ||
| IFNULL(last_checked < now() - interval ? minute, 1) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change need for SQLlite compatibility cause SQLite desn't have BOOLEAN literal |
||
| ` | ||
| err := db.QueryOrchestrator(query, sqlutils.Args(config.Config.AgentPollMinutes), func(m sqlutils.RowMap) error { | ||
| hostname := m.GetString("hostname") | ||
|
|
@@ -461,7 +461,7 @@ func MountLV(hostname string, lv string) (Agent, error) { | |
| return executeAgentCommand(hostname, fmt.Sprintf("mountlv?lv=%s", lv), nil) | ||
| } | ||
|
|
||
| // RemoveLV requests an agent to remvoe a snapshot | ||
| // RemoveLV requests an agent to remove a snapshot | ||
| func RemoveLV(hostname string, lv string) (Agent, error) { | ||
| return executeAgentCommand(hostname, fmt.Sprintf("removelv?lv=%s", lv), nil) | ||
| } | ||
|
|
@@ -547,8 +547,8 @@ func AbortSeed(seedId int64) error { | |
| } | ||
|
|
||
| // PostCopy will request an agent to invoke post-copy commands | ||
| func PostCopy(hostname string) (Agent, error) { | ||
| return executeAgentCommand(hostname, "post-copy", nil) | ||
| func PostCopy(hostname, sourceHostname string) (Agent, error) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change going to break behavior for existing users?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you help me figure out howto add optional parameter to martini routes?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shlomi-noach ok. and add some other improvments and tested it with percona-xtrabackup |
||
| return executeAgentCommand(hostname, fmt.Sprintf("post-copy/?sourceHost=%s", sourceHostname), nil) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is backwards compatibility |
||
| } | ||
|
|
||
| // SubmitSeedEntry submits a new seed operation entry, returning its unique ID | ||
|
|
@@ -693,7 +693,7 @@ func executeSeed(seedId int64, targetHostname string, sourceHostname string) err | |
| } | ||
|
|
||
| seedFromLogicalVolume := sourceAgent.LogicalVolumes[0] | ||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Mounting logical volume: %s", seedFromLogicalVolume.Path), "") | ||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("%s Mounting logical volume: %s", sourceHostname, seedFromLogicalVolume.Path), "") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| _, err = MountLV(sourceHostname, seedFromLogicalVolume.Path) | ||
| if err != nil { | ||
| return updateSeedStateEntry(seedStateId, err) | ||
|
|
@@ -722,8 +722,8 @@ func executeSeed(seedId int64, targetHostname string, sourceHostname string) err | |
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("%s will now receive data in background", targetHostname), "") | ||
| ReceiveMySQLSeedData(targetHostname, seedId) | ||
|
|
||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Waiting some time for %s to start listening for incoming data", targetHostname), "") | ||
| time.Sleep(2 * time.Second) | ||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Waiting %d seconds for %s to start listening for incoming data", config.Config.SeedWaitSecondsBeforeSend, targetHostname), "") | ||
| time.Sleep(time.Duration(config.Config.SeedWaitSecondsBeforeSend) * time.Second) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("%s will now send data to %s in background", sourceHostname, targetHostname), "") | ||
| SendMySQLSeedData(sourceHostname, targetHostname, seedId) | ||
|
|
@@ -774,12 +774,12 @@ func executeSeed(seedId int64, targetHostname string, sourceHostname string) err | |
|
|
||
| // Cleanup: | ||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Executing post-copy command on %s", targetHostname), "") | ||
| _, err = PostCopy(targetHostname) | ||
| _, err = PostCopy(targetHostname, sourceHostname) | ||
| if err != nil { | ||
| return updateSeedStateEntry(seedStateId, err) | ||
| } | ||
|
|
||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Unmounting logical volume: %s", seedFromLogicalVolume.Path), "") | ||
| seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("%s Unmounting logical volume: %s", sourceHostname, seedFromLogicalVolume.Path), "") | ||
| _, err = Unmount(sourceHostname) | ||
| if err != nil { | ||
| return updateSeedStateEntry(seedStateId, err) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,33 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -xeuo pipefail | ||
| # Install orchestrator | ||
| rpm -i /tmp/orchestrator-release/orchestrator*.rpm | ||
| if [[ -e /etc/redhat-release ]]; then | ||
| rpm -i /tmp/orchestrator-release/orchestrator*.rpm | ||
| fi | ||
|
|
||
| if [[ -e /etc/debian_version ]]; then | ||
| dpkg -i /tmp/orchestrator-release/orchestrator*.deb | ||
| fi | ||
|
|
||
| if [[ -e /orchestrator/vagrant/.sqlite ]]; then | ||
| cp -fv /usr/local/orchestrator/orchestrator-sample-sqlite.conf.json /etc/orchestrator.conf.json | ||
| else | ||
| cp -fv /usr/local/orchestrator/orchestrator-sample.conf.json /etc/orchestrator.conf.json | ||
| fi | ||
|
|
||
| if [[ -e /etc/redhat-release ]]; then | ||
|
|
||
| /sbin/chkconfig orchestrator on | ||
| cp /usr/local/orchestrator/orchestrator-sample.conf.json /etc/orchestrator.conf.json | ||
| /sbin/service orchestrator start | ||
|
|
||
| elif [[ -e /etc/debian_version ]]; then | ||
|
|
||
| update-rc.d orchestrator defaults | ||
| cp /usr/local/orchestrator/orchestrator-sample.conf.json /etc/orchestrator.conf.json | ||
| /usr/sbin/service orchestrator start | ||
|
|
||
| fi | ||
|
|
||
| echo '* * * * * root /usr/bin/orchestrator -c discover -i db1' > /etc/cron.d/orchestrator-discovery | ||
|
|
||
| # Discover instances | ||
| /usr/bin/orchestrator -c discover -i localhost | ||
| /usr/bin/orchestrator --verbose --debug --stack -c discover -i localhost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍