Open CyrusZhou-CN opened 2 years ago
部署在容器里面? dcache用到了共享内存, 启动时要指定–ipc=host 另外这个文件记录了共享内存的key, 这个key是通过ftok计算的, 是不是容器里面这个值会变?
感谢,花了1周时间,总算全部运行起来了.
好尴尬,第二天一开机又启动不了了,可能和我用的是windows 10 系统,docker的宿主机重启有关。 目前解决方法是,删除所有 SemKey.dat 文件,然后重启服务
这个值是通过ftok计算出来的, 按说不应改变
我测试了一下重启 docker 服务,就无法运行了,而且所有的服务的 shmSize 值都是 52428800 ,应该是只读取第一个创建的服务的shmSize的值,没有读取到服务本身设置的值。 只有不重启 docker 服务,就没有问题。
[initialize server] .............................. [Done]
--
| ====================================================================================================
| 2022-02-19 12:21:52\|140168575133568\|DEBUG\|CacheServer::addConfig pullConfig result = [succ] get remote config:CacheServer.conf
| 2022-02-19 12:21:52\|140168575133568\|DEBUG\|RouterHandle::initialize Succ
| 2022-02-19 12:21:52\|140168575133568\|DEBUG\|CacheServer::initialize groupName:TestKValueKVGroup1
| 2022-02-19 12:21:52\|140168575133568\|DEBUG\|CacheServer::initialize get semkey from file: /usr/local/app/tars/tarsnode/data/DCache.TestKValueKVCacheServer1-1/data//SemKey.dat succ, semkey = 52428800
| 2022-02-19 12:21:52\|140168575133568\|DEBUG\|CacheServer::initialize /Main/Cache<ShmKey>:52428800
| 2022-02-19 12:21:52\|140168575133568\|DEBUG\|CacheServer::initialize semkey = 52428800
| 2022-02-19 12:21:52\|140168575133568\|ERROR\|[CacheServer::initialize] file: /usr/local/app/tars/tarsnode/data/DCache.TestKValueKVCacheServer1-1/data//SemKey.dat exist, but shmget 52428800 failed, errno = 2,master server assert.
| KVCacheServer: CacheServer.cpp:819: virtual void CacheServer::initialize(): Assertion `false' failed.
[initialize server] .............................. [Done]
| ====================================================================================================
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|MKCacheServer::addConfig pullConfig result = [succ] get remote config:MKCacheServer.conf
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|RouterHandle::initialize Succ
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|MKCacheServer::initialize groupName:TestSetMkvMKVGroup1
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|[MKCacheServer::initialize] open file succ! /usr/local/app/tars/app_log//DCache/TestSetMkvMKVCacheServer1-1/DCache.TestSetMkvMKVCacheServer1-1_binlog_2022021912.log
| 2022-02-19 12:12:12\|140666604607232\|DEBUG\|[CreateBinlogFileThread::Run] start!
| 2022-02-19 12:12:12\|140666604607232\|DEBUG\|[CreateBinlogFileThread::Run] create file!
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|MKCacheServer::initialize get semkey from file: /usr/local/app/tars/tarsnode/data/DCache.TestSetMkvMKVCacheServer1-1/data//SemKey.dat succ, semkey = 52428803
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|CacheServer::initialize /Main/Cache<ShmKey>:52428803
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|MKCacheServer::initialize semkey = 52428803
| 2022-02-19 12:12:12\|140666764209088\|DEBUG\|MKCacheServer::initialize shmSize=52428800
| 2022-02-19 12:12:12\|140666764209088\|ERROR\|[MKCacheServer::initialize] file: /usr/local/app/tars/tarsnode/data/DCache.TestSetMkvMKVCacheServer1-1/data//SemKey.dat exist, but shmget 52428803 failed, errno = 2,master server assert.
| MKVCacheServer: MKCacheServer.cpp:917: virtual void MKCacheServer::initialize(): Assertion `false' failed.
[initialize server] .............................. [Done]
--
| ====================================================================================================
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|MKCacheServer::addConfig pullConfig result = [succ] get remote config:MKCacheServer.conf
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|RouterHandle::initialize Succ
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|MKCacheServer::initialize groupName:TestListMkvMKVGroup1
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|[MKCacheServer::initialize] open file succ! /usr/local/app/tars/app_log//DCache/TestListMkvMKVCacheServer1-1/DCache.TestListMkvMKVCacheServer1-1_binlog_2022021912.log
| 2022-02-19 12:21:55\|139776690747136\|DEBUG\|[CreateBinlogFileThread::Run] start!
| 2022-02-19 12:21:55\|139776690747136\|DEBUG\|[CreateBinlogFileThread::Run] create file!
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|MKCacheServer::initialize get semkey from file: /usr/local/app/tars/tarsnode/data/DCache.TestListMkvMKVCacheServer1-1/data//SemKey.dat succ, semkey = 52428802
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|CacheServer::initialize /Main/Cache<ShmKey>:52428802
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|MKCacheServer::initialize semkey = 52428802
| 2022-02-19 12:21:55\|139776853437376\|DEBUG\|MKCacheServer::initialize shmSize=52428800
| 2022-02-19 12:21:55\|139776853437376\|ERROR\|[MKCacheServer::initialize] file: /usr/local/app/tars/tarsnode/data/DCache.TestListMkvMKVCacheServer1-1/data//SemKey.dat exist, but shmget 52428802 failed, errno = 2,master server assert.
| MKVCacheServer: MKCacheServer.cpp:917: virtual void MKCacheServer::initialize(): Assertion `false' failed.
测试了扩容出来的服务也是无法运行。删除SemKey.dat还是无法运行
[initialize server] .............................. [Done]
| ====================================================================================================
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|CacheServer::addConfig pullConfig result = [succ] get remote config:CacheServer.conf
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|RouterHandle::initialize Succ
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|CacheServer::initialize groupName:TestKValueKVGroup2
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|CacheServer::initialize /Main/Cache<ShmKey>:1141932491
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|CacheServer::initialize semkey = 1141932491
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|initLock finish
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|CacheServer::initialize, initLock finish
| 2022-02-19 12:48:18\|140303062685568\|DEBUG\|initStore start
| [init exception]:[TC_Shm::init()] shmget error :No such file or directory
```
部署在docker里面就会带来这个问题是吧? 之前应该是没人部署在docker里面
有有可能,改天试试真机部署,目前调试不影响使用,就先用着了。
用容器创建的测试环境,刚刚创建的服务,过一会服务状态就会显示Off 删除SemKey.dat文件才可以启动。重启容器后又会出现同样的错误提示。