session属性赋值实现不了,一直报错,TypeError: Cannot set properties of undefined

在编程练习中,遇到session存值报错,经查找发现解决方案是确保session和cookie的引入在路由配置之前。问题解决后,代码运行成功。

在练习session时,往session中存值,一直报错,错误提示如下:

在网上查了,发现是引入位置的问题,应该将session和cookie的位置放在路由前,然后就成功了。

// 停止并重置Group Replication MySQL localhost:33060+ ssl JS > session.runSql('STOP GROUP_REPLICATION'); Query OK, 0 rows affected (0.0008 sec) MySQL localhost:33060+ ssl JS > session.runSql('RESET MASTER'); Session.runSql: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MASTER' at line 1 (MySQL Error 1064) MySQL localhost:33060+ ssl JS > session.runSql('RESET SLAVE ALL'); Session.runSql: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SLAVE ALL' at line 1 (MySQL Error 1064) MySQL localhost:33060+ ssl JS > MySQL localhost:33060+ ssl JS > // 设置正确的GR组名 MySQL localhost:33060+ ssl JS > session.runSql(`SET GLOBAL group_replication_group_name = '9f8c6f7e-5652-11f0-a2e0-000c292cd265'`); Query OK, 0 rows affected (0.0310 sec) MySQL localhost:33060+ ssl JS > MySQL localhost:33060+ ssl JS > // 以引导模式启动 MySQL localhost:33060+ ssl JS > session.runSql('SET GLOBAL group_replication_bootstrap_group=ON'); Query OK, 0 rows affected (0.0113 sec) MySQL localhost:33060+ ssl JS > session.runSql('START GROUP_REPLICATION'); Query OK, 0 rows affected (1.4555 sec) MySQL localhost:33060+ ssl JS > session.runSql('SET GLOBAL group_replication_bootstrap_group=OFF'); Query OK, 0 rows affected (0.0004 sec) MySQL localhost:33060+ ssl JS > MySQL localhost:33060+ ssl JS > // 强制恢复集群 MySQL localhost:33060+ ssl JS > var cluster = dba.rebootClusterFromCompleteOutage("myCluster", { -> force: true, -> grGroupName: '9f8c6f7e-5652-11f0-a2e0-000c292cd265', // 显式指定GR组名 -> timeout: 120 -> }); -> Dba.rebootClusterFromCompleteOutage: Argument #2: Invalid options: grGroupName (ArgumentError) MySQL localhost:33060+ ssl JS > print("集群恢复成功:", cluster.status()); TypeError: Cannot read properties of undefined (reading 'status')
07-16
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值