首页 > 解决方案 > 如何运行 MySQL 数据库作为 Rasa 服务器的跟踪器存储?

问题描述

端点.yml

tracker_store:
    type: SQL
    dialect: "mysql"  # the dialect used to interact with the db
    url: "127.0.0.1:3306"  # (optional) host of the sql db, e.g. "localhost"
    db: "rasa"  # path to your db
    username: "*****" # username used for authentication
    password: "*****"

我正在使用 docker-compose 来运行 Rasa 服务器。

version: '3'
services:
  rasa:
    image: rasa/rasa:1.10.8-full
    expose:
      - "5432"
    ports:
      - "5005:5005"
    volumes:
      - ./:/app
    command: ["run", "--enable-api", "--cors", "*", "--debug"]
  mysql:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - .data/mysql:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: "*****"
      MYSQL_ALLOW_EMPTY_PASSWORD: "No"
      MYSQL_DATABASE: rasa
    ports:
      - "3306"
  app:
    image: rasa_actions:latest
    expose:
    - "5055"

我也试过用 mysql+pymysql 或 postgresql 替换方言。前者给出模块错误,后者给出连接错误,尽管数据库可以正常访问。

我在网上读到 MySQL 和 Rasa 存在一些问题。我需要澄清一下如何使用它。

标签: pythonmysqlsqlrasa

解决方案


您看到哪个错误消息?一般来说,我们建议pymysql用作方言。


推荐阅读