如何解决我可以删除Clickhouse数据上的分离文件夹吗
分离的文件夹中有很多ignored
文件夹,并且占用了太多空间,我可以删除它吗?
[root@cl1-data4 billing_test]# du -h --max-depth=1 ./tb_pay_order_log_local/
40G ./tb_pay_order_log_local/detached
解决方法
如果您完全确定将不再使用这些数据,可以将其从文件系统中手动删除。
我希望使用专门的操作DROP DETACHED PARTITION删除ClickHouse工件:
public class APIClient {
private static final String BASE_URL = "https://example.io/";
private static Retrofit retrofit = null;
public static Retrofit getAPIClient() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.readTimeout(60,TimeUnit.SECONDS)
.connectTimeout(300,TimeUnit.SECONDS)
.build();
if (retrofit == null) {
Gson gson = new GsonBuilder()
.setLenient()
.create();
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.client(okHttpClient)
.build();
}
return retrofit;
}
}
或使其自动化(想法是借来的CH github: Attach all detached partitions #8183):
public abstract class BaseActivity extends AppCompatActivity implements View.OnClickListener {
public int height = 0,width = 0,widthSpace = 0;
public static LayoutInflater mInflater = null;
protected PreferencesManager prefManager = null;
public APIInterFace apiInterFace = null;
public static double selectedLocationLatitude = 0,selectedLocationLongitude = 0;
public static String selectedAddress = "",selectedCity = "",selectedCountry = "";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initializeConstants();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onStop() {
super.onStop();
}
private void initializeConstants() {
Point screenSizePoints = Utils.getDeviceDynamicPixelSize(this);
height = screenSizePoints.y;
width = screenSizePoints.x;
mInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
widthSpace = (int)(width * 0.015);
if (prefManager == null) {
prefManager = PreferencesManager.getInstance(this);
}
if (apiInterFace == null) {
apiInterFace = APIClient.getAPIClient().create(APIInterFace.class);
}
}
public static void createFolder(){
File file = new File(Environment.getExternalStorageDirectory(),"test");
if(!file.exists()){
file.mkdir();
}
}
public static void showProgress(FrameLayout layout) {
if(layout != null) {
layout.setVisibility(View.VISIBLE);
}
}
public static void hideProgress(FrameLayout layout) {
if(layout != null) {
layout.setVisibility(View.GONE);
}
}
@Override
protected void onPause() {
super.onPause();
}
}
,
您可以删除_ignored。
Google翻译:
不活动的部分不会立即删除,因为在写入新的块时,不会调用fsync
,即一段时间以来,新的部分仅位于服务器的RAM(操作系统缓存)中。因此,如果服务器(HW)自发重新启动,则新合并的新部件可能会丢失或损坏。然后,ClickHouse在启动过程中将检查零件的完整性,可以检测到问题,将不活动的零件返回到活动列表,然后再次合并它们。然后,将损坏的部分重命名(添加前缀 broken )并移动到分离的文件夹中。如果完整性检查在合并的块中未发现任何问题,则将原始的非活动块重命名(添加前缀忽略)并移动到分离的文件夹中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。