Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4c45477e
Commit
4c45477e
authored
Jan 16, 2018
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Geo] Add rake geo:status command
See
https://gitlab.com/gitlab-org/gitlab-ee/issues/4411
parent
6aad9fdc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
1 deletion
+73
-1
doc/gitlab-geo/troubleshooting.md
doc/gitlab-geo/troubleshooting.md
+6
-1
lib/tasks/geo.rake
lib/tasks/geo.rake
+67
-0
No files found.
doc/gitlab-geo/troubleshooting.md
View file @
4c45477e
...
@@ -23,6 +23,12 @@ to help identify if something is wrong:
...
@@ -23,6 +23,12 @@ to help identify if something is wrong:
![
GitLab Geo health check
](
img/geo-node-healthcheck.png
)
![
GitLab Geo health check
](
img/geo-node-healthcheck.png
)
There is also an option to check the status of the secondary node by running a special rake task:
```
sudo gitlab-rake geo:status
```
#### Is Postgres replication working?
#### Is Postgres replication working?
#### Are my nodes pointing to the correct database instance?
#### Are my nodes pointing to the correct database instance?
...
@@ -133,4 +139,3 @@ sudo gitlab-ctl reconfigure
...
@@ -133,4 +139,3 @@ sudo gitlab-ctl reconfigure
This will increase the timeout to three hours (10800 seconds). Choose a time
This will increase the timeout to three hours (10800 seconds). Choose a time
long enough to accomodate a full clone of your largest repositories.
long enough to accomodate a full clone of your largest repositories.
lib/tasks/geo.rake
View file @
4c45477e
require
'action_view/helpers'
include
ActionView
::
Helpers
::
DateHelper
include
ActionView
::
Helpers
::
NumberHelper
task
spec:
[
'geo:db:test:prepare'
]
task
spec:
[
'geo:db:test:prepare'
]
namespace
:geo
do
namespace
:geo
do
...
@@ -201,4 +205,67 @@ namespace :geo do
...
@@ -201,4 +205,67 @@ namespace :geo do
Gitlab
::
Geo
::
GeoTasks
.
update_primary_geo_node_url
Gitlab
::
Geo
::
GeoTasks
.
update_primary_geo_node_url
end
end
desc
'Print Geo node status'
task
status: :environment
do
unless
Gitlab
::
Geo
.
license_allows?
puts
'You need a different license to enable Geo replication'
.
color
(
:red
)
exit
end
COLUMN_WIDTH
=
35
current_node_status
=
GeoNodeStatus
.
current_node_status
geo_node
=
current_node_status
.
geo_node
unless
geo_node
.
secondary?
puts
'This command is only available on a secondary node'
.
color
(
:red
)
exit
end
puts
puts
GeoNode
.
current_node_url
puts
'-----------------------------------------------------'
.
color
(
:yellow
)
print
'GitLab version: '
.
rjust
(
COLUMN_WIDTH
)
puts
Gitlab
::
VERSION
print
'Health Status: '
.
rjust
(
COLUMN_WIDTH
)
puts
current_node_status
.
health_status
print
'Repositories: '
.
rjust
(
COLUMN_WIDTH
)
print
"
#{
current_node_status
.
repositories_synced_count
}
/
#{
current_node_status
.
repositories_count
}
"
puts
"(
#{
number_to_percentage
(
current_node_status
.
repositories_synced_in_percentage
,
precision:
0
)
}
)"
print
'LFS objects: '
.
rjust
(
COLUMN_WIDTH
)
print
"
#{
current_node_status
.
lfs_objects_synced_count
}
/
#{
current_node_status
.
lfs_objects_count
}
"
puts
"(
#{
number_to_percentage
(
current_node_status
.
lfs_objects_synced_in_percentage
,
precision:
0
)
}
)"
print
'Attachments: '
.
rjust
(
COLUMN_WIDTH
)
print
"
#{
current_node_status
.
attachments_synced_count
}
/
#{
current_node_status
.
attachments_count
}
"
puts
"(
#{
number_to_percentage
(
current_node_status
.
attachments_synced_in_percentage
,
precision:
0
)
}
)"
print
'Wikis: '
.
rjust
(
COLUMN_WIDTH
)
print
"
#{
current_node_status
.
wikis_synced_count
}
/
#{
current_node_status
.
wikis_count
}
"
puts
"(
#{
number_to_percentage
(
current_node_status
.
wikis_synced_in_percentage
,
precision:
0
)
}
)"
print
'Sync settings: '
.
rjust
(
COLUMN_WIDTH
)
puts
geo_node
.
namespaces
.
any?
?
'Selective'
:
'Full'
print
'Database replication lag: '
.
rjust
(
COLUMN_WIDTH
)
puts
"
#{
Gitlab
::
Geo
::
HealthCheck
.
db_replication_lag_seconds
}
seconds"
print
'Last event ID seen from primary: '
.
rjust
(
COLUMN_WIDTH
)
last_event
=
Geo
::
EventLog
.
last
last_event_id
=
last_event
&
.
id
print
last_event_id
puts
"(
#{
time_ago_in_words
(
last_event
&
.
created_at
)
}
ago)"
print
'Last event ID processed by cursor: '
.
rjust
(
COLUMN_WIDTH
)
cursor_last_event_id
=
Geo
::
EventLogState
.
last_processed
&
.
event_id
if
cursor_last_event_id
print
cursor_last_event_id
puts
"(
#{
time_ago_in_words
(
Geo
::
EventLog
.
find_by
(
id:
cursor_last_event_id
)
&
.
created_at
)
}
ago)"
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment