作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我将我的整个模型和参数记录到 mlflow 中时,我认为将其置于用户名和密码下进行保护是个好主意。
我使用以下代码运行mlflow服务器mlflow server --host 0.0.0.0 --port 11111
完美运行,在我的浏览器中输入 myip:11111
我看到了一切(最终是问题所在)
如果我理解文档和以下内容 https://groups.google.com/forum/#!topic/mlflow-users/E9QW4HdS8a8此处链接正确,我应该使用 nginx 来创建身份验证。
我安装了 nginx open sourcre
和 apache2-utils
已创建 sudo htpasswd -c /etc/apache2/.htpasswd user1
用户和密码。
我编辑了我的 /etc/nginx/nginx.conf
到以下几点:
server {
listen 80;
listen 443 ssl;
server_name my_ip;
root NOT_SURE_WHICH_PATH_TO_PUT_HERE, THE VENV?;
location / {
proxy_pass my_ip:11111/;
auth_basic "Restricted Content";
auth_basic_user_file /home/path to the password file/.htpasswd;
}
}
listen 11111
我收到一个错误,该端口已在使用中(当然,由 mlflow 服务器....)
最佳答案
这里的问题是 mlflow
和 nginx
正在尝试在 上运行同一个端口 ...
sudo nano mlflow
并删除现有的默认值。server {
listen YOUR_PORT;
server_name YOUR_IP_OR_DOMAIN;
auth_basic “Administrator’s Area”;
auth_basic_user_file /etc/apache2/.htpasswd; #read the link below how to set username and pwd in nginx
location / {
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
proxy_redirect off;
}
}
sudo systemctl restart nginx
mlflow server --host localhost --port 8000
export MLFLOW_TRACKING_USERNAME=user export MLFLOW_TRACKING_PASSWORD=pwd
/venv/lib/python3.6/site-packages/mlflowpackages/mlflow/tracking/_tracking_service/utils.py
中编辑函数def _get_rest_store(store_uri, **_):
def get_default_host_creds():
return rest_utils.MlflowHostCreds(
host=store_uri,
username=replace with nginx user
password=replace with nginx pwd
token=os.environ.get(_TRACKING_TOKEN_ENV_VAR),
ignore_tls_verification=os.environ.get(_TRACKING_INSECURE_TLS_ENV_VAR) == 'true',
)
import mlflow
remote_server_uri = "YOUR_IP_OR_DOMAIN:YOUR_PORT" # set to your server URI
mlflow.set_tracking_uri(remote_server_uri)
mlflow.set_experiment("/my-experiment")
with mlflow.start_run():
mlflow.log_param("a", 1)
mlflow.log_metric("b", 2)
关于nginx - 如何在 mlFlow 服务器上运行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58956459/
我是一名优秀的程序员,十分优秀!