分区的主实例或无状态实例的地址无效
The primary or stateless instance for the partition has invalid address
我使用开箱即用的分区创建了有状态服务:
<StatefulService ServiceTypeName="ExamplesServiceType" TargetReplicaSetSize="[ExamplesService_TargetReplicaSetSize]" MinReplicaSetSize="[ExamplesService_MinReplicaSetSize]">
<UniformInt64Partition PartitionCount="[ExamplesService_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
</StatefulService>
服务清单将参数设置为(开箱即用):
<Parameter Name="ExampleService_PartitionCount" Value="1" />
<Parameter Name="ExampleService_MinReplicaSetSize" Value="2" />
<Parameter Name="ExampleService_TargetReplicaSetSize" Value="3" />
<Parameter Name="WebService_InstanceCount" Value="1" />
现在我想从同一集群中的无状态服务调用有状态服务:
ServiceUriBuilder builder = new ServiceUriBuilder(ExampleServiceName);
var service = ServiceProxy.Create<IExampleService>(builder.ToUri(),new ServicePartitionKey(1));
return service.MyCallAsync(id);
我收到以下错误:
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
我正在尝试将日志记录到事件日志的有状态服务,并且日志携带 "partitionId":"a67f7afa-3370-4e6f-ae7c-15188004bfa1"。
我错过了什么?
我没有按照 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)) };
}
万一其他人来到这里想知道如何处理无状态服务,这对我有用:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[] { new ServiceInstanceListener(context => this.CreateServiceRemotingListener(context)) };
}
对于使用 Microsoft.ServiceFabric.Services.Remoting
版本 3.3.638 的用户,
我发现没有名为CreateServiceInstanceListeners()
的扩展方法。我只在 Microsoft.ServiceFabric.Services.Remoting.Runtime.ServiceRemotingExtensions
.
中找到了 CreateServiceRemotingInstanceListeners()
和 CreateServiceRemotingReplicaListeners()
为我编译的代码:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return this.CreateServiceRemotingInstanceListeners();
}
我使用开箱即用的分区创建了有状态服务:
<StatefulService ServiceTypeName="ExamplesServiceType" TargetReplicaSetSize="[ExamplesService_TargetReplicaSetSize]" MinReplicaSetSize="[ExamplesService_MinReplicaSetSize]">
<UniformInt64Partition PartitionCount="[ExamplesService_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
</StatefulService>
服务清单将参数设置为(开箱即用):
<Parameter Name="ExampleService_PartitionCount" Value="1" />
<Parameter Name="ExampleService_MinReplicaSetSize" Value="2" />
<Parameter Name="ExampleService_TargetReplicaSetSize" Value="3" />
<Parameter Name="WebService_InstanceCount" Value="1" />
现在我想从同一集群中的无状态服务调用有状态服务:
ServiceUriBuilder builder = new ServiceUriBuilder(ExampleServiceName);
var service = ServiceProxy.Create<IExampleService>(builder.ToUri(),new ServicePartitionKey(1));
return service.MyCallAsync(id);
我收到以下错误:
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
我正在尝试将日志记录到事件日志的有状态服务,并且日志携带 "partitionId":"a67f7afa-3370-4e6f-ae7c-15188004bfa1"。
我错过了什么?
我没有按照 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)) };
}
万一其他人来到这里想知道如何处理无状态服务,这对我有用:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[] { new ServiceInstanceListener(context => this.CreateServiceRemotingListener(context)) };
}
对于使用 Microsoft.ServiceFabric.Services.Remoting
版本 3.3.638 的用户,
我发现没有名为CreateServiceInstanceListeners()
的扩展方法。我只在 Microsoft.ServiceFabric.Services.Remoting.Runtime.ServiceRemotingExtensions
.
CreateServiceRemotingInstanceListeners()
和 CreateServiceRemotingReplicaListeners()
为我编译的代码:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return this.CreateServiceRemotingInstanceListeners();
}