The primary or stateless instance for the partition has invalid address

匿名 (未验证) 提交于 2019-12-03 02:23:02

问题:

I created a stateful service with the out-of-the-box partitioning:

<StatefulService ServiceTypeName="ExamplesServiceType" TargetReplicaSetSize="[ExamplesService_TargetReplicaSetSize]" MinReplicaSetSize="[ExamplesService_MinReplicaSetSize]">             <UniformInt64Partition PartitionCount="[ExamplesService_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />          </StatefulService> 

The service manifest sets the params to (out-of-the-box as well):

 <Parameter Name="ExampleService_PartitionCount" Value="1" />  <Parameter Name="ExampleService_MinReplicaSetSize" Value="2" />  <Parameter Name="ExampleService_TargetReplicaSetSize" Value="3" />  <Parameter Name="WebService_InstanceCount" Value="1" /> 

Now I want to call to to my stateful service from my stateless service in the same cluster:

 ServiceUriBuilder builder = new ServiceUriBuilder(ExampleServiceName);  var service = ServiceProxy.Create<IExampleService>(builder.ToUri(),new ServicePartitionKey(1));   return service.MyCallAsync(id); 

I'm getting the following error:

The primary or stateless instance for the partition 'a67f7afa-3370-4e6f-ae7c-15188004bfa1' has invalid address, this means that right address from the replica/instance is not registered in the system

The stateful service I'm trying to reach logs to the event logs and the logs carry "partitionId": "a67f7afa-3370-4e6f-ae7c-15188004bfa1".

What am I missing?

回答1:

I wasn't registering a remote as explained at http://vunvulearadu.blogspot.com/2016/04/azure-service-fabric-primary-or.html

        protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()     {         return new[] { new ServiceReplicaListener(context => this.CreateServiceRemotingListener(context)) };     } 


回答2:

In case anyone else comes here wondering what to do for stateless services, this works for me:

protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners() {     return new[] { new ServiceInstanceListener(context => this.CreateServiceRemotingListener(context)) }; } 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!