DB::Exception: test: Authentication failed:

问题描述:想限制特定的IP可以访问clickhouse,使用如下语句创建用户

drop user test;
CREATE USER test HOST IP '172.18.xxx.xxx'  IDENTIFIED WITH sha256_password BY 'test';
GRANT SHOW, SELECT, INSERT ON test.* TO test;

客户端登陆:
确保输入的用户名和密码是正确的

clickhouse-client --host 172.18.xxx.xxx  --port 9000  --user test --password test  -m

错误信息:
Received from 172.18.xxx.xxx:9000. DB::Exception: test: Authentication failed:
password is incorrect or there is no user with such name.

ClickHouse client version 21.4.6.55 (official build).
Connecting to 172.18.52.122:9000 as user test.
Code: 516. DB::Exception:
     Received from 172.18.xxx.xxx:9000. DB::Exception: test: Authentication failed:
     password is incorrect or there is no user with such name.

问题解决过程:

1.telnet 数据库是通的
telnet 172.18.xxx.xxx 9000

2.创建用户不指定IP时可以正常访问数据库。
drop user test;
CREATE USER test IDENTIFIED WITH sha256_password BY ‘test’;
GRANT SHOW, SELECT, INSERT ON test.* TO test;

用户名,密码是正确的,网络也是通的,为什么指定IP后就不能正常访问呢?
首先想到的是去看clickhouse的日志,但查询clickhouse的日志也没发现有价值的信息。
还有什么地方能提供有用的信息呢,cilckhouse的query_log 出现了

3.查看query_log 后发现,initial_address并不是客户端的IP,而是网关的地址。
select initial_address n from system.query_log ql where user=‘test’
为什么是网关的地址呢,原来客户端与clickhouse不在同一个网段,跨网段访问,要经过网关。

4.把授权IP地址改为网关后,可以正常访问。
但这样就失去了限制 IP 地址可以访问clickhouse的意义。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Remote URL test failed: Authentication failed for是指远程URL测试失败,认证失败的意思。这可能是由于以下几个原因导致的: 1. SSH配置错误:可能您没有正确配置SSH公钥或者使用了错误的SSH地址。您可以尝试将地址更改为使用https而不是SSH,并确保已正确设置SSH公钥。 2. 权限不足:如果您已设置好SSH公钥但仍无法访问远程URL,可能是由于您对该项目的访问权限不足。您可以尝试使用其他开源项目的地址进行测试,如果可以成功克隆,则说明您尝试克隆的项目地址可能是错误的或您的权限不够。 3. 文件权限问题:如果您正在使用vsftp进行测试,并且遇到"Remote URL test failed: Authentication failed for"错误,可能是由于文件权限问题导致的。您可以确保/var/ftp目录下的文件和/var/ftp/pub目录下的文件具有正确的权限设置,例如将文件权限设置为644,以确保其他用户可以访问它们。 请根据您的具体情况检查以上可能的原因,并采取相应的措施来解决认证失败的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Remote URL test failed: protocol ‘Remote URL test failed: Authentication failed for,不能clone,...](https://blog.csdn.net/weixin_43135178/article/details/115636949)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [Linux FTP服务配置](https://download.csdn.net/download/jsuani/2901766)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值