harbor上主从两个仓库,配置同步规则时,定时任务配置太频繁,导致规则修改,删除都失败。
点击修改后保存,页面报internal server error的错。
docker ps | grep harbor
查看docker日志,日志中也没有报错。
从页面删除任务失败,是因为里面有“InProgress”的任务,后面需要手动更改sql,update
http://ip:port/api/v2.0/replication/policies
在查出的内容中,搜索 有问题的规则名称? ,找到其id?
在查出的内容中,搜索??InProgress? 找出类型是InProgress的id值。
3.删除有问题的任务
docker exec -it harbor-db bash
psql -U postgres
\c registry
\d replication_execution
实例操作:
# docker exec -it harbor-db bash
postgres [ / ]$ psql -U postgres
psql (9.6.14)
Type "help" for help.
postgres=# \c registry
You are now connected to database "registry" as user "postgres".
registry=# \d replication_execution
Table "public.replication_execution"
Column | Type | Modifiers
-------------+-----------------------------+--------------------------------------------------------------------
id | integer | not null default nextval('replication_execution_id_seq'::regclass)
policy_id | integer | not null
status | character varying(32) |
status_text | text |
total | integer | not null default 0
failed | integer | not null default 0
succeed | integer | not null default 0
in_progress | integer | not null default 0
stopped | integer | not null default 0
trigger | character varying(64) |
start_time | timestamp without time zone | default now()
end_time | timestamp without time zone |
Indexes:
"replication_execution_pkey" PRIMARY KEY, btree (id)
"execution_policy" btree (policy_id)
registry=#
查询表? replication_execution
# select * from replication_execution;
id | policy_id | status | status_text | total | failed | succeed | in_progress | stopped | trigger | start_time | end_time
----+-----------+--------+-------------+-------+--------+---------+-------------+---------+---------+------------+----------
需要注意的是,查询的sql末尾是有;的。因为之前没加; 语句没结束,没有返回,一直以为是表中是空值。
将有问题的任务,status更新为f? , 在语句中,status='f',用引号给括起来。
?