lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.44k stars 514 forks source link

lealone-mysql-plugin插件,在每次重启lealone服务以后,就需要再次手动启动mysql插件,能否做成lealone服务重启,自动启动插件 #228

Open tangzhongshan opened 1 month ago

tangzhongshan commented 1 month ago

还有lealone-mysql-plugin插件,在每次重启lealone服务以后,就需要再次手动启动mysql插件,这个可以做成在lealone服务启动以后,自动启动mysql插件

codefollower commented 1 month ago

还有lealone-mysql-plugin插件,在每次重启lealone服务以后,就需要再次手动启动mysql插件,这个可以做成在lealone服务启动以后,自动启动mysql插件

create、start plugin 命令是用于动态管理插件, 想要自动启动 mysql 插件,有个更简单的办法,不需要执行 create、start plugin 命令的。 先把 lealone-mysql-plugin-6.0.0.jar 扔到 lealone 安装目录的 lib 子目录中, 然后像下面这样配置一下 conf/lealone.yaml

sql_engines:
  - name: Lealone
    enabled: true
    parameters: {
        # key1: v1,
        # key2: v2,
    }
  - name: MySQL
    enabled: true
    parameters: {
        # key1: v1,
        # key2: v2,
    }

protocol_server_engines:
  - name: TCP
    enabled: true
    parameters: {
        port: 9210,
        allow_others: true,
        ssl: false
    }
  - name: MySQL
    enabled: true
    parameters: {
        port: 3306,
        allow_others: true,
        ssl: false
    }
codefollower commented 1 month ago

一开始 lealone 6 是内置 MySQL、PostgreSQL、MongoDB 这三个插件的,启动 lealone 就能用它们了,就是在 conf/lealone.yaml 中默认配置好了,但是并不是所有人都需要这些插件,都集成在一起占用内存和硬盘空间。

codefollower commented 1 month ago

lealone 6 最新代码已经新增 auto_start 参数用于自动启动插件

用法:

create plugin if not exists mysql
  implement by 'com.lealone.plugins.mysql.MySQLPlugin' 
  class path 'E:\lealone\lealone-plugins\mysql\target\lealone-mysql-plugin-6.0.0.jar'
  parameters (port=9410, host='127.0.0.1', auto_start=true);

auto_start 为 true 时,不再需要执行 start plugin,启动数据库时也会自动启动这个插件。