Home-assistant_v2.db over 20 gb

Hello Every Body, I try to undestand how to make a good History/recorder but for now my home-assistant_v2.db is over 20 gb !!!
I would like keep some sensor for two week but for some sensor i would like to keep it for many years (it’s sensor for Sun power and electrical power consuption.
Now i don’t have recoder entry in my configuration.yaml but i add recently this code for history:

history:
  exclude:
    domains:
      - light
      - switch
      - media_player
      - binary.sensor
    entities:
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_current_4
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_current_3
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_current_2
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_current
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_voltage_4
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_voltage_3
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_voltage_2
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_voltage
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_9
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_7
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_6
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_5
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_21
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_20
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_19
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_13
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_12
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_11
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_18
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_14
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_10
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_energy_4
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_energy_3
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_energy_2
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_17
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_16
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_previous_reading_15
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_power_4
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_power_3
      - sensor.aeon_labs_zw095_home_energy_meter_gen5_power_2
      - sensor.processor_use
      - sensor.memory_free
      - sensor.disk_use_percent_home
      - sensor.last_boot
      - sensor.load_1m
      - sensor.load_5m
      - sensor.load_15m
      - sensor.network_in_eth0
      - sensor.network_out_eth0
      - sensor.network_throughput_in_eth0
      - sensor.network_throughput_out_eth0
      - sensor.s1total
      - sensor.s1yesterday
      - sensor.s1today
      - sensor.s1puissance
      - sensor.s1courrant
      - sensor.s1voltage
      - sensor.s2total
      - sensor.s2yesterday
      - sensor.s2today
      - sensor.s2puissance
      - sensor.s2courrant
      - sensor.s2voltage
      - sensor.s3total
      - sensor.s3yesterday
      - sensor.s3today
      - sensor.s3puissance
      - sensor.s3courrant
      - sensor.s3voltage
      - sensor.s4total
      - sensor.s4yesterday
      - sensor.s4today
      - sensor.s4puissance
      - sensor.s4courrant
      - sensor.s4voltage
      - sensor.synology_dsm_cpu_load_total
      - sensor.synology_dsm_memory_usage_real
      - sensor.synology_dsm_network_down
      - sensor.synology_dsm_network_up
      - sensor.synology_dsm_temperature_sda
      - sensor.synology_dsm_temperature_sdb
      - sensor.synology_dsm_volume_used_volume_1
      - sensor.synology_dsm_volume_used_volume_2
      - camera.bienvenue
      - camera.jardin
      - camera.garage
      - camera.video_entree
      - sensor.hall_d_entree_temperature
      - sensor.bureau_temperature
      - sensor.capteur_salle_a_manger_temperature
      - sensor.salle_de_jeux_temperature
      - sensor.salle_de_bain_temperature
      - sensor.temperature_8
      - sensor.temperature_4
      - sensor.temperature_15
      - sensor.temperature_18
      - sensor.temperature_21
      - sensor.temperature_12
      - sensor.hall_d_entree_humidity
      - sensor.bureau_humidity
      - sensor.salle_de_bain_humidity
      - sensor.salle_de_jeux_humidity
      - sensor.humidity_9
      - sensor.humidity_5
      - sensor.humidity_16
      - sensor.humidity_19
      - sensor.humidity_22
      - sensor.pressure_14
      - sensor.pressure_10
      - sensor.pressure_6
      - sensor.pressure_17
      - sensor.pressure_20
      - sensor.pressure_23
      - sensor.netatmo_interieur_temperature
      - sensor.netatmo_interieur_min_temp
      - sensor.netatmo_interieur_max_temp
      - sensor.netatmo_interieur_humidity
      - sensor.netatmo_interieur_co2
      - sensor.netatmo_interieur_noise
      - sensor.netatmo_interieur_pressure
      - sensor.netatmo_interieur_wifi
      - sensor.capteur_salle_a_manger_light_level
      - sensor.netatmo_jardin_temperature
      - sensor.netatmo_jardin_min_temp
      - sensor.netatmo_jardin_max_temp
      - sensor.netatmo_jardin_humidity
      - sensor.netatmo_jardin_radio
      - sensor.netatmo_jardin_battery_percent 

Can you help me please

For the long term data use influxdb and grafana.

I have Influxdb but how to keep the good information in influxdb ?