n9e-helm icon indicating copy to clipboard operation
n9e-helm copied to clipboard

通过helm方式安装,配置只修改value.yaml里面expose: type: loadBalancer,无法连接数据库

Open sawchen opened this issue 11 months ago • 3 comments

启动状态如下 kubectl get pod -n n9e NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nightingale-categraf-v6-6t2rh 1/1 Running 0 9m3s 10.30.60.105 kylin105 nightingale-categraf-v6-n7hqg 1/1 Running 0 9m3s 10.30.60.103 kylin103 nightingale-categraf-v6-xwczl 1/1 Running 0 9m3s 10.30.60.109 kylin109 nightingale-center-6f4f6ccb66-s26j4 0/1 CrashLoopBackOff 6 (2m40s ago) 9m3s 10.0.1.240 kylin105 nightingale-database-0 1/1 Running 1 (7m4s ago) 9m3s 10.0.0.106 kylin103 nightingale-nginx-858cc757d7-9bsdz 0/1 Running 1 (3m41s ago) 9m3s 10.0.2.59 kylin109 nightingale-prometheus-0 1/1 Running 0 9m3s 10.0.2.164 kylin109 nightingale-redis-0 1/1 Running 0 9m3s 10.0.0.107 kylin103

查询nightingale-center-6f4f6ccb66-s26j4报错信息如下 kubectl logs nightingale-center-6f4f6ccb66-s26j4 -n n9e runner.cwd: /app runner.hostname: nightingale-center-6f4f6ccb66-s26j4 runner.fd_limits: (soft=1073741816, hard=1073741816) runner.vm_limits: (soft=unlimited, hard=unlimited)

2024/03/07 18:34:23 main.go:39: failed to initialize: Error 1130: Host '10.0.1.240' is not allowed to connect to this MySQL server 2024/03/07 18:34:23 /home/runner/work/nightingale/nightingale/pkg/ormx/ormx.go:45 [error] failed to initialize database, got error Error 1130: Host '10.0.1.240' is not allowed to connect to this MySQL server

查询数据库状态是启动成功,是否需要配置权限?需要修改哪个文件 nightingale-database-0
kubectl logs nightingale-database-0 -n n9e 2024-03-07 18:32:46+08:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' 2024-03-07T10:33:08.928594Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-03-07T10:33:08.929675Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 1 ... 2024-03-07T10:33:08.932188Z 0 [Note] InnoDB: PUNCH HOLE support available 2024-03-07T10:33:08.932210Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2024-03-07T10:33:08.932232Z 0 [Note] InnoDB: Uses event mutexes 2024-03-07T10:33:08.932235Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2024-03-07T10:33:08.932237Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2024-03-07T10:33:08.932239Z 0 [Note] InnoDB: Using Linux native AIO 2024-03-07T10:33:08.932416Z 0 [Note] InnoDB: Number of pools: 1 2024-03-07T10:33:08.932531Z 0 [Note] InnoDB: Using CPU crc32 instructions 2024-03-07T10:33:08.933583Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2024-03-07T10:33:08.939303Z 0 [Note] InnoDB: Completed initialization of buffer pool 2024-03-07T10:33:08.940746Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2024-03-07T10:33:08.963996Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2024-03-07T10:33:08.966787Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2768310 2024-03-07T10:33:08.966808Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 2768319 2024-03-07T10:33:08.966814Z 0 [Note] InnoDB: Database was not shutdown normally! 2024-03-07T10:33:08.966817Z 0 [Note] InnoDB: Starting crash recovery. 2024-03-07T10:33:09.117149Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" 2024-03-07T10:33:09.117180Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2024-03-07T10:33:09.117211Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2024-03-07T10:33:09.190116Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2024-03-07T10:33:09.190711Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2024-03-07T10:33:09.190725Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2024-03-07T10:33:09.191356Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 2768319 2024-03-07T10:33:09.191490Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 2024-03-07T10:33:09.191768Z 0 [Note] Plugin 'FEDERATED' is disabled. 2024-03-07T10:33:09.199948Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 2024-03-07T10:33:09.199964Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. 2024-03-07T10:33:09.199968Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2024-03-07T10:33:09.199970Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2024-03-07T10:33:09.206507Z 0 [Note] InnoDB: Buffer pool(s) load completed at 240307 18:33:09 2024-03-07T10:33:09.207632Z 0 [Warning] CA certificate ca.pem is self signed. 2024-03-07T10:33:09.207670Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. 2024-03-07T10:33:09.209148Z 0 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 2024-03-07T10:33:09.209179Z 0 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 2024-03-07T10:33:09.209198Z 0 [Note] Server socket created on IP: '0.0.0.0'. 2024-03-07T10:33:09.210601Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2024-03-07T10:33:09.294142Z 0 [Note] Event Scheduler: Loaded 0 events 2024-03-07T10:33:09.294366Z 0 [Note] mysqld: ready for connections. Version: '5.7.44' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) 2024-03-07T10:34:23.388913Z 2 [Warning] IP address '10.0.1.240' could not be resolved: Name or service not known

sawchen avatar Mar 07 '24 11:03 sawchen

values.yaml中有关于database的配置,可以先了解下helm的用法

kongfei605 avatar Mar 08 '24 01:03 kongfei605

values.yaml中有关于database的配置,可以先了解下helm的用法 我这边values.yaml是使用默认,这种配置应该使用internal相关的配置吧?账号密码都没作修改 database: type: internal internal: serviceAccountName: "" automountServiceAccountToken: false image: repository: docker.io/library/mysql tag: 5.7 username: "root" password: "1234" shmSizeLimit: 512Mi nodeSelector: {} resources: {} tolerations: [] affinity: {} priorityClassName: initContainer: migrator: {} permissions: {} external: host: "192.168.0.1" port: "3306" name: "n9e_v6" username: "user" password: "password" sslmode: "disable" maxIdleConns: 100 maxOpenConns: 900 podAnnotations: {}

---关于持久化存储使用storageclass,对应的pvc也成功创建并绑定 persistence: enabled: true resourcePolicy: "keep" persistentVolumeClaim: database: existingClaim: "" storageClass: "csi-rbd-sc" subPath: "" accessMode: ReadWriteOnce size: 4Gi redis: existingClaim: "" storageClass: "csi-rbd-sc" subPath: "" accessMode: ReadWriteOnce size: 1Gi prometheus: existingClaim: "" storageClass: "csi-rbd-sc" subPath: "" accessMode: ReadWriteOnce size: 4Gi

sawchen avatar Mar 08 '24 01:03 sawchen

database不使用internal,改为对接之前在k8s集群自搭建的mysql,可以正常运行所有服务,暂时解决了问题 现在已创建的数据库跑初始化数据库脚本 https://github.com/flashcatcloud/n9e-helm/blob/master/scripts/a-n9e.sql 然后修改 database相关配置修改如下 database: type: external internal: serviceAccountName: "" automountServiceAccountToken: false image: repository: docker.io/library/mysql tag: 5.7 username: "root" password: "1234" shmSizeLimit: 512Mi nodeSelector: {} resources: {} tolerations: [] affinity: {} priorityClassName: initContainer: migrator: {} permissions: {} external: host: "mariadb-test.test.svc.cluster.local" port: "3306" name: "n9e_v6" username: "root" password: "XXXXXXXX" sslmode: "disable" maxIdleConns: 100 maxOpenConns: 900 podAnnotations: {} 仅供大家参考

sawchen avatar Mar 11 '24 08:03 sawchen