我正在尝试为我的 SQL Server 添加 SPN 条目,但 SQL Server 正在 NT 权限帐户(如 SYSTEM 或 LOCAL SERVICE)下运行。
当我输入 setspn 代码时,它说找不到用户。这可以吗?尝试运行以下命令:
setspn -L MSSQLSvc/SQLSERVER1 "NT AUTHORITY\LOCAL SERVICE"
我正在尝试为我的 SQL Server 添加 SPN 条目,但 SQL Server 正在 NT 权限帐户(如 SYSTEM 或 LOCAL SERVICE)下运行。
当我输入 setspn 代码时,它说找不到用户。这可以吗?尝试运行以下命令:
setspn -L MSSQLSvc/SQLSERVER1 "NT AUTHORITY\LOCAL SERVICE"
我不知道为什么在我的“城市”表中搜索如此缓慢。我的查询正在寻找距离城市约 25 公里的“城市”表。我使用这个简单的查询,数据库需要将近 20 秒才能返回结果。
SELECT city_destination,distance FROM cities WHERE city_start='Wien' AND distance <= 25 ORDER BY distance ASC
表引擎是 InnoDB。该表有约。700万行:
+--------------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| id_of_start | int(11) | NO | | NULL | |
| id_of_destination | int(11) | NO | | NULL | |
| city_start | text | NO | | NULL | |
| city_destination | text | NO | | NULL | |
| distance | double | NO | | NULL | |
+--------------------+-------------+------+-----+---------+----------------+
谁能告诉我如何优化数据库或查询?
我正在尝试为 sql server 设置安全证书。根据文档,我需要设置权限,以便 sql server 实例可以读取私钥。我尝试通过 mmc 设置权限(请参阅https://stackoverflow.com/questions/36830411/how-can-i-give-sql-server-permission-to-read-my-ssl-key)。我右键单击证书,选择“所有任务”,选择“管理私钥”,它会弹出用户对话框。问题是,sql server 实例作为“NT Service\MSSQLSERVER”运行。该用户未出现在组或用户名部分中,如果我尝试将其添加为新用户,我将找不到它。
我尝试了此处列出的过程: 如何将网络服务添加到用户权限组? 但我仍然无法找到该用户或组。我在这里做错了什么?
我们已经迁移了一个数据库(备份到 .bacpac 并恢复到新租户),但该数据库使用始终加密的方式进行加密,并且密钥存储在原始租户的密钥库中。我可以通过在第一个租户尝试解密时对其进行身份验证来查看 SQL 管理工作室中的数据(它会自动弹出身份验证对话框),但我需要移动密钥以便我的 Web 应用程序也可以访问它。它是否可以从一个租户迁移到另一个租户,或者这将成为导出和重新导入数据的手动过程?
无法通过网络连接到 sql server 实例,SSMS 给我的所有信息都是 258 错误。
一切都应该是正确的。
我错过了什么吗?我正在仔细检查网络内其他服务器的配置,似乎没有任何遗漏。
我有一堆包含不同数据库的 docker 容器。对于每个容器,都有一个 Jenkins-Job,它每天将数据库备份为 .sql 文件,然后压缩该文件。正如您可以想象的那样,随着时间的推移,这会导致大量冗余数据:
-rw-r--r--. 1 admin admin 103475967 30. Aug 02:15 20210830021501_all-databases.sql.gz
-rw-r--r--. 1 admin admin 103475967 31. Aug 02:15 20210831021501_all-databases.sql.gz
-rw-r--r--. 1 admin admin 103475967 1. Sep 02:15 20210901021501_all-databases.sql.gz
通常您会使用数据库特定的滚动备份工具。但我想通过只导出一个 .sql 文件来保持简单和通用。
现在我正在寻找一种方法来存储 .sql 文件的差异。有几个问题(这里和这里的例子)导致 rdiff-backup 作为一个很好的工具。但对我来说,似乎 rdiff-backup 旨在处理整个文件夹,例如数据库存储数据的文件夹,而不是 sql 文件本身。
是否有一种工具可以存储数据库独立 init .sql 文件并从那里仅存储差异。
我正在测试 repmgr 工具,我有点困惑。一切都很好,直到standby register
步骤。
我应该在standby
服务器上配置什么?从文档中我认为不standby
应该有集群,但它没有配置新的集群。当postgres
集群存在时repmgr
,现有数据存在问题。当我将停止集群服务并手动删除数据并从repmgr
启动集群后运行迁移时出现错误:
postgres@ip-10-0-34-147:~$ /usr/lib/postgresql/13/bin/pg_ctl -D /var/lib/postgresql/13/main start
waiting for server to start....postgres: could not access the server configuration file "/var/lib/postgresql/13/main/postgresql.conf": No such file or directory
stopped waiting
pg_ctl: could not start server
Examine the log output.
它正在运行Ubuntu
,但可能更适用Debian
。但我仍然不知道如何使它正确。
我目前正在为我们公司的 CI/CD 管道添加一个额外的步骤,以便我们在进行可能在我们的数据库上运行迁移的部署之前备份数据库。
为了进行备份,我使用以下命令向 Google Cloud Platform 进行身份验证:
gcloud auth activate-service-account --key-file /path/to/keyfile.json
验证后我使用命令:
gcloud sql backups create --async --instance instance_name
我的问题是关于添加异步标志的含义是什么。我知道这样做意味着我的管道不会等待备份完成再继续下一步,但是,如果下一步涉及运行可能会破坏某些东西的迁移,这是否意味着我在上一步可能最终处于迁移已部分运行的中间状态?
谷歌实际上是如何处理备份创建的?他们是否在那个时间点对数据库进行快照,然后从中进行备份?删除 --async 标志以确保在运行任何潜在迁移之前完成备份会更安全吗?
我试过查看文档,但并没有真正详细说明这一点。
如何确定 ip 地址或 url 地址日志?我的 mysql-slow-query 中有这个
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 11:12:39
# User@Host: root[root] @ localhost []
# Query_time: 51.904912 Lock_time: 0.000103 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587287559;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 11:43:06
# User@Host: root[root] @ localhost []
# Query_time: 973.189006 Lock_time: 0.000097 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587289386;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 11:59:27
# User@Host: root[root] @ localhost []
# Query_time: 144.803710 Lock_time: 0.000022 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587290367;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 12:21:58
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 590.385342 Lock_time: 0.000102 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587291718;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 12:27:31
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 18.139393 Lock_time: 0.000039 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587292051;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 12:51:08
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 530.583547 Lock_time: 0.000022 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587293468;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 12:58:07
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 43.678108 Lock_time: 0.000078 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587293887;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 13:13:41
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 72.950484 Lock_time: 0.000083 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587294821;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 13:26:14
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 45.907777 Lock_time: 0.000025 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587295574;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 13:48:59
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 1106.049268 Lock_time: 0.000077 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587296939;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 13:56:32
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 338.521235 Lock_time: 0.000076 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587297392;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 14:06:26
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 321.585240 Lock_time: 0.000103 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587297986;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 200419 14:12:51
# User@Host: nutecredinstare[nutecredinstare] @ localhost []
# Query_time: 83.491684 Lock_time: 0.000038 Rows_sent: 0 Rows_examined: 0
use lastfiles;
SET timestamp=1587298371;
SELECT id,name,descr,filename,size,category,seeders,leechers,added FROM torrents WHERE category IN (25 AnD SlEeP(3000)) AND visible='yes' ORDER BY added DESC LIMIT 15;
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.5.62-0ubuntu0.14.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
情况
acc
HttpResponse
错误消息包含装饰器.py
from django.http import HttpResponse
from django.shortcuts import redirect
def unauthenticated_user(view_func):
def wrapper_func(request, *args, **kwargs):
if request.user.is_authenticated:
return redirect('home')
else:
return view_func(request, *args, **kwargs)
return wrapper_func
def allowed_users(allowed_roles=[]):
def decorator(view_func):
def wrapper_func(request, *args, **kwargs):
group = None
if request.user.groups.exists():
group = request.user.groups.all()[0].name
if group in allowed_roles:
return view_func(request, *args, **kwargs)
else:
return HttpResponse('Authorized')
return wrapper_func
return decorator
错误
如果我在 settings.py 使用PostgreSQL时登录。如果我注销一切正常。如果我使用 SQL lite,我可以登录并且一切正常
ValueError at /
The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.
Request Method: GET
Request URL: http://localhost...
Django Version: 3.0
Exception Type: ValueError
Exception Value: The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.
Exception Location: /Users/.../python3.7/site-packages/django/core/handlers/base.py in _get_response, line 126
Python Executable: /Users/.../bin/python3
Python Version: 3.7.3
.....
Request information
USER MYUSERNAME
GET No GET data
POST No POST data
FILES No FILES data
COOKIES ...
...
试图解决
python manage.py migrate
时说Running migrations: No migrations to apply.
python manage.py loaddata db.json
DoesNotExist at /register/
Group matching query does not exist.